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
519mod internal {
520    use super::*;
521    unsafe impl fidl::encoding::TypeMarker for Availability {
522        type Owned = Self;
523
524        #[inline(always)]
525        fn inline_align(_context: fidl::encoding::Context) -> usize {
526            std::mem::align_of::<u32>()
527        }
528
529        #[inline(always)]
530        fn inline_size(_context: fidl::encoding::Context) -> usize {
531            std::mem::size_of::<u32>()
532        }
533
534        #[inline(always)]
535        fn encode_is_copy() -> bool {
536            true
537        }
538
539        #[inline(always)]
540        fn decode_is_copy() -> bool {
541            false
542        }
543    }
544
545    impl fidl::encoding::ValueTypeMarker for Availability {
546        type Borrowed<'a> = Self;
547        #[inline(always)]
548        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
549            *value
550        }
551    }
552
553    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Availability {
554        #[inline]
555        unsafe fn encode(
556            self,
557            encoder: &mut fidl::encoding::Encoder<'_, D>,
558            offset: usize,
559            _depth: fidl::encoding::Depth,
560        ) -> fidl::Result<()> {
561            encoder.debug_check_bounds::<Self>(offset);
562            encoder.write_num(self.into_primitive(), offset);
563            Ok(())
564        }
565    }
566
567    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Availability {
568        #[inline(always)]
569        fn new_empty() -> Self {
570            Self::Required
571        }
572
573        #[inline]
574        unsafe fn decode(
575            &mut self,
576            decoder: &mut fidl::encoding::Decoder<'_, D>,
577            offset: usize,
578            _depth: fidl::encoding::Depth,
579        ) -> fidl::Result<()> {
580            decoder.debug_check_bounds::<Self>(offset);
581            let prim = decoder.read_num::<u32>(offset);
582
583            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
584            Ok(())
585        }
586    }
587    unsafe impl fidl::encoding::TypeMarker for CapabilityStoreError {
588        type Owned = Self;
589
590        #[inline(always)]
591        fn inline_align(_context: fidl::encoding::Context) -> usize {
592            std::mem::align_of::<u32>()
593        }
594
595        #[inline(always)]
596        fn inline_size(_context: fidl::encoding::Context) -> usize {
597            std::mem::size_of::<u32>()
598        }
599
600        #[inline(always)]
601        fn encode_is_copy() -> bool {
602            false
603        }
604
605        #[inline(always)]
606        fn decode_is_copy() -> bool {
607            false
608        }
609    }
610
611    impl fidl::encoding::ValueTypeMarker for CapabilityStoreError {
612        type Borrowed<'a> = Self;
613        #[inline(always)]
614        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
615            *value
616        }
617    }
618
619    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
620        for CapabilityStoreError
621    {
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 CapabilityStoreError {
636        #[inline(always)]
637        fn new_empty() -> Self {
638            Self::unknown()
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_allow_unknown(prim);
652            Ok(())
653        }
654    }
655    unsafe impl fidl::encoding::TypeMarker for DictionaryError {
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 DictionaryError {
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 DictionaryError
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 DictionaryError {
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 RouterError {
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 RouterError {
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> for RouterError {
756        #[inline]
757        unsafe fn encode(
758            self,
759            encoder: &mut fidl::encoding::Encoder<'_, D>,
760            offset: usize,
761            _depth: fidl::encoding::Depth,
762        ) -> fidl::Result<()> {
763            encoder.debug_check_bounds::<Self>(offset);
764            encoder.write_num(self.into_primitive(), offset);
765            Ok(())
766        }
767    }
768
769    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RouterError {
770        #[inline(always)]
771        fn new_empty() -> Self {
772            Self::unknown()
773        }
774
775        #[inline]
776        unsafe fn decode(
777            &mut self,
778            decoder: &mut fidl::encoding::Decoder<'_, D>,
779            offset: usize,
780            _depth: fidl::encoding::Depth,
781        ) -> fidl::Result<()> {
782            decoder.debug_check_bounds::<Self>(offset);
783            let prim = decoder.read_num::<u32>(offset);
784
785            *self = Self::from_primitive_allow_unknown(prim);
786            Ok(())
787        }
788    }
789
790    impl fidl::encoding::ValueTypeMarker for CapabilityStoreDictionaryCopyRequest {
791        type Borrowed<'a> = &'a Self;
792        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
793            value
794        }
795    }
796
797    unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDictionaryCopyRequest {
798        type Owned = Self;
799
800        #[inline(always)]
801        fn inline_align(_context: fidl::encoding::Context) -> usize {
802            8
803        }
804
805        #[inline(always)]
806        fn inline_size(_context: fidl::encoding::Context) -> usize {
807            16
808        }
809        #[inline(always)]
810        fn encode_is_copy() -> bool {
811            true
812        }
813
814        #[inline(always)]
815        fn decode_is_copy() -> bool {
816            true
817        }
818    }
819
820    unsafe impl<D: fidl::encoding::ResourceDialect>
821        fidl::encoding::Encode<CapabilityStoreDictionaryCopyRequest, D>
822        for &CapabilityStoreDictionaryCopyRequest
823    {
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::<CapabilityStoreDictionaryCopyRequest>(offset);
832            unsafe {
833                // Copy the object into the buffer.
834                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
835                (buf_ptr as *mut CapabilityStoreDictionaryCopyRequest)
836                    .write_unaligned((self as *const CapabilityStoreDictionaryCopyRequest).read());
837                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
838                // done second because the memcpy will write garbage to these bytes.
839            }
840            Ok(())
841        }
842    }
843    unsafe impl<
844            D: fidl::encoding::ResourceDialect,
845            T0: fidl::encoding::Encode<u64, D>,
846            T1: fidl::encoding::Encode<u64, D>,
847        > fidl::encoding::Encode<CapabilityStoreDictionaryCopyRequest, D> for (T0, T1)
848    {
849        #[inline]
850        unsafe fn encode(
851            self,
852            encoder: &mut fidl::encoding::Encoder<'_, D>,
853            offset: usize,
854            depth: fidl::encoding::Depth,
855        ) -> fidl::Result<()> {
856            encoder.debug_check_bounds::<CapabilityStoreDictionaryCopyRequest>(offset);
857            // Zero out padding regions. There's no need to apply masks
858            // because the unmasked parts will be overwritten by fields.
859            // Write the fields.
860            self.0.encode(encoder, offset + 0, depth)?;
861            self.1.encode(encoder, offset + 8, depth)?;
862            Ok(())
863        }
864    }
865
866    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
867        for CapabilityStoreDictionaryCopyRequest
868    {
869        #[inline(always)]
870        fn new_empty() -> Self {
871            Self { id: fidl::new_empty!(u64, D), dest_id: fidl::new_empty!(u64, D) }
872        }
873
874        #[inline]
875        unsafe fn decode(
876            &mut self,
877            decoder: &mut fidl::encoding::Decoder<'_, D>,
878            offset: usize,
879            _depth: fidl::encoding::Depth,
880        ) -> fidl::Result<()> {
881            decoder.debug_check_bounds::<Self>(offset);
882            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
883            // Verify that padding bytes are zero.
884            // Copy from the buffer into the object.
885            unsafe {
886                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
887            }
888            Ok(())
889        }
890    }
891
892    impl fidl::encoding::ValueTypeMarker for CapabilityStoreDictionaryCreateRequest {
893        type Borrowed<'a> = &'a Self;
894        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
895            value
896        }
897    }
898
899    unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDictionaryCreateRequest {
900        type Owned = Self;
901
902        #[inline(always)]
903        fn inline_align(_context: fidl::encoding::Context) -> usize {
904            8
905        }
906
907        #[inline(always)]
908        fn inline_size(_context: fidl::encoding::Context) -> usize {
909            8
910        }
911        #[inline(always)]
912        fn encode_is_copy() -> bool {
913            true
914        }
915
916        #[inline(always)]
917        fn decode_is_copy() -> bool {
918            true
919        }
920    }
921
922    unsafe impl<D: fidl::encoding::ResourceDialect>
923        fidl::encoding::Encode<CapabilityStoreDictionaryCreateRequest, D>
924        for &CapabilityStoreDictionaryCreateRequest
925    {
926        #[inline]
927        unsafe fn encode(
928            self,
929            encoder: &mut fidl::encoding::Encoder<'_, D>,
930            offset: usize,
931            _depth: fidl::encoding::Depth,
932        ) -> fidl::Result<()> {
933            encoder.debug_check_bounds::<CapabilityStoreDictionaryCreateRequest>(offset);
934            unsafe {
935                // Copy the object into the buffer.
936                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
937                (buf_ptr as *mut CapabilityStoreDictionaryCreateRequest).write_unaligned(
938                    (self as *const CapabilityStoreDictionaryCreateRequest).read(),
939                );
940                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
941                // done second because the memcpy will write garbage to these bytes.
942            }
943            Ok(())
944        }
945    }
946    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
947        fidl::encoding::Encode<CapabilityStoreDictionaryCreateRequest, D> for (T0,)
948    {
949        #[inline]
950        unsafe fn encode(
951            self,
952            encoder: &mut fidl::encoding::Encoder<'_, D>,
953            offset: usize,
954            depth: fidl::encoding::Depth,
955        ) -> fidl::Result<()> {
956            encoder.debug_check_bounds::<CapabilityStoreDictionaryCreateRequest>(offset);
957            // Zero out padding regions. There's no need to apply masks
958            // because the unmasked parts will be overwritten by fields.
959            // Write the fields.
960            self.0.encode(encoder, offset + 0, depth)?;
961            Ok(())
962        }
963    }
964
965    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
966        for CapabilityStoreDictionaryCreateRequest
967    {
968        #[inline(always)]
969        fn new_empty() -> Self {
970            Self { id: fidl::new_empty!(u64, D) }
971        }
972
973        #[inline]
974        unsafe fn decode(
975            &mut self,
976            decoder: &mut fidl::encoding::Decoder<'_, D>,
977            offset: usize,
978            _depth: fidl::encoding::Depth,
979        ) -> fidl::Result<()> {
980            decoder.debug_check_bounds::<Self>(offset);
981            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
982            // Verify that padding bytes are zero.
983            // Copy from the buffer into the object.
984            unsafe {
985                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
986            }
987            Ok(())
988        }
989    }
990
991    impl fidl::encoding::ValueTypeMarker for CapabilityStoreDictionaryGetRequest {
992        type Borrowed<'a> = &'a Self;
993        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
994            value
995        }
996    }
997
998    unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDictionaryGetRequest {
999        type Owned = Self;
1000
1001        #[inline(always)]
1002        fn inline_align(_context: fidl::encoding::Context) -> usize {
1003            8
1004        }
1005
1006        #[inline(always)]
1007        fn inline_size(_context: fidl::encoding::Context) -> usize {
1008            32
1009        }
1010    }
1011
1012    unsafe impl<D: fidl::encoding::ResourceDialect>
1013        fidl::encoding::Encode<CapabilityStoreDictionaryGetRequest, D>
1014        for &CapabilityStoreDictionaryGetRequest
1015    {
1016        #[inline]
1017        unsafe fn encode(
1018            self,
1019            encoder: &mut fidl::encoding::Encoder<'_, D>,
1020            offset: usize,
1021            _depth: fidl::encoding::Depth,
1022        ) -> fidl::Result<()> {
1023            encoder.debug_check_bounds::<CapabilityStoreDictionaryGetRequest>(offset);
1024            // Delegate to tuple encoding.
1025            fidl::encoding::Encode::<CapabilityStoreDictionaryGetRequest, D>::encode(
1026                (
1027                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1028                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
1029                        &self.key,
1030                    ),
1031                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dest_id),
1032                ),
1033                encoder,
1034                offset,
1035                _depth,
1036            )
1037        }
1038    }
1039    unsafe impl<
1040            D: fidl::encoding::ResourceDialect,
1041            T0: fidl::encoding::Encode<u64, D>,
1042            T1: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
1043            T2: fidl::encoding::Encode<u64, D>,
1044        > fidl::encoding::Encode<CapabilityStoreDictionaryGetRequest, D> for (T0, T1, T2)
1045    {
1046        #[inline]
1047        unsafe fn encode(
1048            self,
1049            encoder: &mut fidl::encoding::Encoder<'_, D>,
1050            offset: usize,
1051            depth: fidl::encoding::Depth,
1052        ) -> fidl::Result<()> {
1053            encoder.debug_check_bounds::<CapabilityStoreDictionaryGetRequest>(offset);
1054            // Zero out padding regions. There's no need to apply masks
1055            // because the unmasked parts will be overwritten by fields.
1056            // Write the fields.
1057            self.0.encode(encoder, offset + 0, depth)?;
1058            self.1.encode(encoder, offset + 8, depth)?;
1059            self.2.encode(encoder, offset + 24, depth)?;
1060            Ok(())
1061        }
1062    }
1063
1064    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1065        for CapabilityStoreDictionaryGetRequest
1066    {
1067        #[inline(always)]
1068        fn new_empty() -> Self {
1069            Self {
1070                id: fidl::new_empty!(u64, D),
1071                key: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
1072                dest_id: fidl::new_empty!(u64, D),
1073            }
1074        }
1075
1076        #[inline]
1077        unsafe fn decode(
1078            &mut self,
1079            decoder: &mut fidl::encoding::Decoder<'_, D>,
1080            offset: usize,
1081            _depth: fidl::encoding::Depth,
1082        ) -> fidl::Result<()> {
1083            decoder.debug_check_bounds::<Self>(offset);
1084            // Verify that padding bytes are zero.
1085            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
1086            fidl::decode!(
1087                fidl::encoding::BoundedString<255>,
1088                D,
1089                &mut self.key,
1090                decoder,
1091                offset + 8,
1092                _depth
1093            )?;
1094            fidl::decode!(u64, D, &mut self.dest_id, decoder, offset + 24, _depth)?;
1095            Ok(())
1096        }
1097    }
1098
1099    impl fidl::encoding::ValueTypeMarker for CapabilityStoreDictionaryInsertRequest {
1100        type Borrowed<'a> = &'a Self;
1101        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1102            value
1103        }
1104    }
1105
1106    unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDictionaryInsertRequest {
1107        type Owned = Self;
1108
1109        #[inline(always)]
1110        fn inline_align(_context: fidl::encoding::Context) -> usize {
1111            8
1112        }
1113
1114        #[inline(always)]
1115        fn inline_size(_context: fidl::encoding::Context) -> usize {
1116            32
1117        }
1118    }
1119
1120    unsafe impl<D: fidl::encoding::ResourceDialect>
1121        fidl::encoding::Encode<CapabilityStoreDictionaryInsertRequest, D>
1122        for &CapabilityStoreDictionaryInsertRequest
1123    {
1124        #[inline]
1125        unsafe fn encode(
1126            self,
1127            encoder: &mut fidl::encoding::Encoder<'_, D>,
1128            offset: usize,
1129            _depth: fidl::encoding::Depth,
1130        ) -> fidl::Result<()> {
1131            encoder.debug_check_bounds::<CapabilityStoreDictionaryInsertRequest>(offset);
1132            // Delegate to tuple encoding.
1133            fidl::encoding::Encode::<CapabilityStoreDictionaryInsertRequest, D>::encode(
1134                (
1135                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1136                    <DictionaryItem as fidl::encoding::ValueTypeMarker>::borrow(&self.item),
1137                ),
1138                encoder,
1139                offset,
1140                _depth,
1141            )
1142        }
1143    }
1144    unsafe impl<
1145            D: fidl::encoding::ResourceDialect,
1146            T0: fidl::encoding::Encode<u64, D>,
1147            T1: fidl::encoding::Encode<DictionaryItem, D>,
1148        > fidl::encoding::Encode<CapabilityStoreDictionaryInsertRequest, D> for (T0, T1)
1149    {
1150        #[inline]
1151        unsafe fn encode(
1152            self,
1153            encoder: &mut fidl::encoding::Encoder<'_, D>,
1154            offset: usize,
1155            depth: fidl::encoding::Depth,
1156        ) -> fidl::Result<()> {
1157            encoder.debug_check_bounds::<CapabilityStoreDictionaryInsertRequest>(offset);
1158            // Zero out padding regions. There's no need to apply masks
1159            // because the unmasked parts will be overwritten by fields.
1160            // Write the fields.
1161            self.0.encode(encoder, offset + 0, depth)?;
1162            self.1.encode(encoder, offset + 8, depth)?;
1163            Ok(())
1164        }
1165    }
1166
1167    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1168        for CapabilityStoreDictionaryInsertRequest
1169    {
1170        #[inline(always)]
1171        fn new_empty() -> Self {
1172            Self { id: fidl::new_empty!(u64, D), item: fidl::new_empty!(DictionaryItem, D) }
1173        }
1174
1175        #[inline]
1176        unsafe fn decode(
1177            &mut self,
1178            decoder: &mut fidl::encoding::Decoder<'_, D>,
1179            offset: usize,
1180            _depth: fidl::encoding::Depth,
1181        ) -> fidl::Result<()> {
1182            decoder.debug_check_bounds::<Self>(offset);
1183            // Verify that padding bytes are zero.
1184            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
1185            fidl::decode!(DictionaryItem, D, &mut self.item, decoder, offset + 8, _depth)?;
1186            Ok(())
1187        }
1188    }
1189
1190    impl fidl::encoding::ValueTypeMarker for CapabilityStoreDictionaryRemoveRequest {
1191        type Borrowed<'a> = &'a Self;
1192        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1193            value
1194        }
1195    }
1196
1197    unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDictionaryRemoveRequest {
1198        type Owned = Self;
1199
1200        #[inline(always)]
1201        fn inline_align(_context: fidl::encoding::Context) -> usize {
1202            8
1203        }
1204
1205        #[inline(always)]
1206        fn inline_size(_context: fidl::encoding::Context) -> usize {
1207            32
1208        }
1209    }
1210
1211    unsafe impl<D: fidl::encoding::ResourceDialect>
1212        fidl::encoding::Encode<CapabilityStoreDictionaryRemoveRequest, D>
1213        for &CapabilityStoreDictionaryRemoveRequest
1214    {
1215        #[inline]
1216        unsafe fn encode(
1217            self,
1218            encoder: &mut fidl::encoding::Encoder<'_, D>,
1219            offset: usize,
1220            _depth: fidl::encoding::Depth,
1221        ) -> fidl::Result<()> {
1222            encoder.debug_check_bounds::<CapabilityStoreDictionaryRemoveRequest>(offset);
1223            // Delegate to tuple encoding.
1224            fidl::encoding::Encode::<CapabilityStoreDictionaryRemoveRequest, D>::encode(
1225                (
1226                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1227                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.key),
1228                    <fidl::encoding::Boxed<WrappedCapabilityId> as fidl::encoding::ValueTypeMarker>::borrow(&self.dest_id),
1229                ),
1230                encoder, offset, _depth
1231            )
1232        }
1233    }
1234    unsafe impl<
1235            D: fidl::encoding::ResourceDialect,
1236            T0: fidl::encoding::Encode<u64, D>,
1237            T1: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
1238            T2: fidl::encoding::Encode<fidl::encoding::Boxed<WrappedCapabilityId>, D>,
1239        > fidl::encoding::Encode<CapabilityStoreDictionaryRemoveRequest, D> for (T0, T1, T2)
1240    {
1241        #[inline]
1242        unsafe fn encode(
1243            self,
1244            encoder: &mut fidl::encoding::Encoder<'_, D>,
1245            offset: usize,
1246            depth: fidl::encoding::Depth,
1247        ) -> fidl::Result<()> {
1248            encoder.debug_check_bounds::<CapabilityStoreDictionaryRemoveRequest>(offset);
1249            // Zero out padding regions. There's no need to apply masks
1250            // because the unmasked parts will be overwritten by fields.
1251            // Write the fields.
1252            self.0.encode(encoder, offset + 0, depth)?;
1253            self.1.encode(encoder, offset + 8, depth)?;
1254            self.2.encode(encoder, offset + 24, depth)?;
1255            Ok(())
1256        }
1257    }
1258
1259    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1260        for CapabilityStoreDictionaryRemoveRequest
1261    {
1262        #[inline(always)]
1263        fn new_empty() -> Self {
1264            Self {
1265                id: fidl::new_empty!(u64, D),
1266                key: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
1267                dest_id: fidl::new_empty!(fidl::encoding::Boxed<WrappedCapabilityId>, D),
1268            }
1269        }
1270
1271        #[inline]
1272        unsafe fn decode(
1273            &mut self,
1274            decoder: &mut fidl::encoding::Decoder<'_, D>,
1275            offset: usize,
1276            _depth: fidl::encoding::Depth,
1277        ) -> fidl::Result<()> {
1278            decoder.debug_check_bounds::<Self>(offset);
1279            // Verify that padding bytes are zero.
1280            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
1281            fidl::decode!(
1282                fidl::encoding::BoundedString<255>,
1283                D,
1284                &mut self.key,
1285                decoder,
1286                offset + 8,
1287                _depth
1288            )?;
1289            fidl::decode!(
1290                fidl::encoding::Boxed<WrappedCapabilityId>,
1291                D,
1292                &mut self.dest_id,
1293                decoder,
1294                offset + 24,
1295                _depth
1296            )?;
1297            Ok(())
1298        }
1299    }
1300
1301    impl fidl::encoding::ValueTypeMarker for CapabilityStoreDropRequest {
1302        type Borrowed<'a> = &'a Self;
1303        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1304            value
1305        }
1306    }
1307
1308    unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDropRequest {
1309        type Owned = Self;
1310
1311        #[inline(always)]
1312        fn inline_align(_context: fidl::encoding::Context) -> usize {
1313            8
1314        }
1315
1316        #[inline(always)]
1317        fn inline_size(_context: fidl::encoding::Context) -> usize {
1318            8
1319        }
1320        #[inline(always)]
1321        fn encode_is_copy() -> bool {
1322            true
1323        }
1324
1325        #[inline(always)]
1326        fn decode_is_copy() -> bool {
1327            true
1328        }
1329    }
1330
1331    unsafe impl<D: fidl::encoding::ResourceDialect>
1332        fidl::encoding::Encode<CapabilityStoreDropRequest, D> for &CapabilityStoreDropRequest
1333    {
1334        #[inline]
1335        unsafe fn encode(
1336            self,
1337            encoder: &mut fidl::encoding::Encoder<'_, D>,
1338            offset: usize,
1339            _depth: fidl::encoding::Depth,
1340        ) -> fidl::Result<()> {
1341            encoder.debug_check_bounds::<CapabilityStoreDropRequest>(offset);
1342            unsafe {
1343                // Copy the object into the buffer.
1344                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1345                (buf_ptr as *mut CapabilityStoreDropRequest)
1346                    .write_unaligned((self as *const CapabilityStoreDropRequest).read());
1347                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1348                // done second because the memcpy will write garbage to these bytes.
1349            }
1350            Ok(())
1351        }
1352    }
1353    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1354        fidl::encoding::Encode<CapabilityStoreDropRequest, D> for (T0,)
1355    {
1356        #[inline]
1357        unsafe fn encode(
1358            self,
1359            encoder: &mut fidl::encoding::Encoder<'_, D>,
1360            offset: usize,
1361            depth: fidl::encoding::Depth,
1362        ) -> fidl::Result<()> {
1363            encoder.debug_check_bounds::<CapabilityStoreDropRequest>(offset);
1364            // Zero out padding regions. There's no need to apply masks
1365            // because the unmasked parts will be overwritten by fields.
1366            // Write the fields.
1367            self.0.encode(encoder, offset + 0, depth)?;
1368            Ok(())
1369        }
1370    }
1371
1372    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1373        for CapabilityStoreDropRequest
1374    {
1375        #[inline(always)]
1376        fn new_empty() -> Self {
1377            Self { id: fidl::new_empty!(u64, D) }
1378        }
1379
1380        #[inline]
1381        unsafe fn decode(
1382            &mut self,
1383            decoder: &mut fidl::encoding::Decoder<'_, D>,
1384            offset: usize,
1385            _depth: fidl::encoding::Depth,
1386        ) -> fidl::Result<()> {
1387            decoder.debug_check_bounds::<Self>(offset);
1388            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1389            // Verify that padding bytes are zero.
1390            // Copy from the buffer into the object.
1391            unsafe {
1392                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1393            }
1394            Ok(())
1395        }
1396    }
1397
1398    impl fidl::encoding::ValueTypeMarker for CapabilityStoreDuplicateRequest {
1399        type Borrowed<'a> = &'a Self;
1400        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1401            value
1402        }
1403    }
1404
1405    unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDuplicateRequest {
1406        type Owned = Self;
1407
1408        #[inline(always)]
1409        fn inline_align(_context: fidl::encoding::Context) -> usize {
1410            8
1411        }
1412
1413        #[inline(always)]
1414        fn inline_size(_context: fidl::encoding::Context) -> usize {
1415            16
1416        }
1417        #[inline(always)]
1418        fn encode_is_copy() -> bool {
1419            true
1420        }
1421
1422        #[inline(always)]
1423        fn decode_is_copy() -> bool {
1424            true
1425        }
1426    }
1427
1428    unsafe impl<D: fidl::encoding::ResourceDialect>
1429        fidl::encoding::Encode<CapabilityStoreDuplicateRequest, D>
1430        for &CapabilityStoreDuplicateRequest
1431    {
1432        #[inline]
1433        unsafe fn encode(
1434            self,
1435            encoder: &mut fidl::encoding::Encoder<'_, D>,
1436            offset: usize,
1437            _depth: fidl::encoding::Depth,
1438        ) -> fidl::Result<()> {
1439            encoder.debug_check_bounds::<CapabilityStoreDuplicateRequest>(offset);
1440            unsafe {
1441                // Copy the object into the buffer.
1442                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1443                (buf_ptr as *mut CapabilityStoreDuplicateRequest)
1444                    .write_unaligned((self as *const CapabilityStoreDuplicateRequest).read());
1445                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1446                // done second because the memcpy will write garbage to these bytes.
1447            }
1448            Ok(())
1449        }
1450    }
1451    unsafe impl<
1452            D: fidl::encoding::ResourceDialect,
1453            T0: fidl::encoding::Encode<u64, D>,
1454            T1: fidl::encoding::Encode<u64, D>,
1455        > fidl::encoding::Encode<CapabilityStoreDuplicateRequest, D> for (T0, T1)
1456    {
1457        #[inline]
1458        unsafe fn encode(
1459            self,
1460            encoder: &mut fidl::encoding::Encoder<'_, D>,
1461            offset: usize,
1462            depth: fidl::encoding::Depth,
1463        ) -> fidl::Result<()> {
1464            encoder.debug_check_bounds::<CapabilityStoreDuplicateRequest>(offset);
1465            // Zero out padding regions. There's no need to apply masks
1466            // because the unmasked parts will be overwritten by fields.
1467            // Write the fields.
1468            self.0.encode(encoder, offset + 0, depth)?;
1469            self.1.encode(encoder, offset + 8, depth)?;
1470            Ok(())
1471        }
1472    }
1473
1474    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1475        for CapabilityStoreDuplicateRequest
1476    {
1477        #[inline(always)]
1478        fn new_empty() -> Self {
1479            Self { id: fidl::new_empty!(u64, D), dest_id: fidl::new_empty!(u64, D) }
1480        }
1481
1482        #[inline]
1483        unsafe fn decode(
1484            &mut self,
1485            decoder: &mut fidl::encoding::Decoder<'_, D>,
1486            offset: usize,
1487            _depth: fidl::encoding::Depth,
1488        ) -> fidl::Result<()> {
1489            decoder.debug_check_bounds::<Self>(offset);
1490            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1491            // Verify that padding bytes are zero.
1492            // Copy from the buffer into the object.
1493            unsafe {
1494                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1495            }
1496            Ok(())
1497        }
1498    }
1499
1500    impl fidl::encoding::ValueTypeMarker for CapabilityStoreExportRequest {
1501        type Borrowed<'a> = &'a Self;
1502        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1503            value
1504        }
1505    }
1506
1507    unsafe impl fidl::encoding::TypeMarker for CapabilityStoreExportRequest {
1508        type Owned = Self;
1509
1510        #[inline(always)]
1511        fn inline_align(_context: fidl::encoding::Context) -> usize {
1512            8
1513        }
1514
1515        #[inline(always)]
1516        fn inline_size(_context: fidl::encoding::Context) -> usize {
1517            8
1518        }
1519        #[inline(always)]
1520        fn encode_is_copy() -> bool {
1521            true
1522        }
1523
1524        #[inline(always)]
1525        fn decode_is_copy() -> bool {
1526            true
1527        }
1528    }
1529
1530    unsafe impl<D: fidl::encoding::ResourceDialect>
1531        fidl::encoding::Encode<CapabilityStoreExportRequest, D> for &CapabilityStoreExportRequest
1532    {
1533        #[inline]
1534        unsafe fn encode(
1535            self,
1536            encoder: &mut fidl::encoding::Encoder<'_, D>,
1537            offset: usize,
1538            _depth: fidl::encoding::Depth,
1539        ) -> fidl::Result<()> {
1540            encoder.debug_check_bounds::<CapabilityStoreExportRequest>(offset);
1541            unsafe {
1542                // Copy the object into the buffer.
1543                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1544                (buf_ptr as *mut CapabilityStoreExportRequest)
1545                    .write_unaligned((self as *const CapabilityStoreExportRequest).read());
1546                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1547                // done second because the memcpy will write garbage to these bytes.
1548            }
1549            Ok(())
1550        }
1551    }
1552    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1553        fidl::encoding::Encode<CapabilityStoreExportRequest, D> for (T0,)
1554    {
1555        #[inline]
1556        unsafe fn encode(
1557            self,
1558            encoder: &mut fidl::encoding::Encoder<'_, D>,
1559            offset: usize,
1560            depth: fidl::encoding::Depth,
1561        ) -> fidl::Result<()> {
1562            encoder.debug_check_bounds::<CapabilityStoreExportRequest>(offset);
1563            // Zero out padding regions. There's no need to apply masks
1564            // because the unmasked parts will be overwritten by fields.
1565            // Write the fields.
1566            self.0.encode(encoder, offset + 0, depth)?;
1567            Ok(())
1568        }
1569    }
1570
1571    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1572        for CapabilityStoreExportRequest
1573    {
1574        #[inline(always)]
1575        fn new_empty() -> Self {
1576            Self { id: fidl::new_empty!(u64, D) }
1577        }
1578
1579        #[inline]
1580        unsafe fn decode(
1581            &mut self,
1582            decoder: &mut fidl::encoding::Decoder<'_, D>,
1583            offset: usize,
1584            _depth: fidl::encoding::Depth,
1585        ) -> fidl::Result<()> {
1586            decoder.debug_check_bounds::<Self>(offset);
1587            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1588            // Verify that padding bytes are zero.
1589            // Copy from the buffer into the object.
1590            unsafe {
1591                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1592            }
1593            Ok(())
1594        }
1595    }
1596
1597    impl fidl::encoding::ValueTypeMarker for DictionaryDrainIteratorGetNextRequest {
1598        type Borrowed<'a> = &'a Self;
1599        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1600            value
1601        }
1602    }
1603
1604    unsafe impl fidl::encoding::TypeMarker for DictionaryDrainIteratorGetNextRequest {
1605        type Owned = Self;
1606
1607        #[inline(always)]
1608        fn inline_align(_context: fidl::encoding::Context) -> usize {
1609            8
1610        }
1611
1612        #[inline(always)]
1613        fn inline_size(_context: fidl::encoding::Context) -> usize {
1614            16
1615        }
1616    }
1617
1618    unsafe impl<D: fidl::encoding::ResourceDialect>
1619        fidl::encoding::Encode<DictionaryDrainIteratorGetNextRequest, D>
1620        for &DictionaryDrainIteratorGetNextRequest
1621    {
1622        #[inline]
1623        unsafe fn encode(
1624            self,
1625            encoder: &mut fidl::encoding::Encoder<'_, D>,
1626            offset: usize,
1627            _depth: fidl::encoding::Depth,
1628        ) -> fidl::Result<()> {
1629            encoder.debug_check_bounds::<DictionaryDrainIteratorGetNextRequest>(offset);
1630            unsafe {
1631                // Copy the object into the buffer.
1632                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1633                (buf_ptr as *mut DictionaryDrainIteratorGetNextRequest)
1634                    .write_unaligned((self as *const DictionaryDrainIteratorGetNextRequest).read());
1635                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1636                // done second because the memcpy will write garbage to these bytes.
1637                let padding_ptr = buf_ptr.offset(8) as *mut u64;
1638                let padding_mask = 0xffffffff00000000u64;
1639                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
1640            }
1641            Ok(())
1642        }
1643    }
1644    unsafe impl<
1645            D: fidl::encoding::ResourceDialect,
1646            T0: fidl::encoding::Encode<u64, D>,
1647            T1: fidl::encoding::Encode<u32, D>,
1648        > fidl::encoding::Encode<DictionaryDrainIteratorGetNextRequest, D> for (T0, T1)
1649    {
1650        #[inline]
1651        unsafe fn encode(
1652            self,
1653            encoder: &mut fidl::encoding::Encoder<'_, D>,
1654            offset: usize,
1655            depth: fidl::encoding::Depth,
1656        ) -> fidl::Result<()> {
1657            encoder.debug_check_bounds::<DictionaryDrainIteratorGetNextRequest>(offset);
1658            // Zero out padding regions. There's no need to apply masks
1659            // because the unmasked parts will be overwritten by fields.
1660            unsafe {
1661                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1662                (ptr as *mut u64).write_unaligned(0);
1663            }
1664            // Write the fields.
1665            self.0.encode(encoder, offset + 0, depth)?;
1666            self.1.encode(encoder, offset + 8, depth)?;
1667            Ok(())
1668        }
1669    }
1670
1671    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1672        for DictionaryDrainIteratorGetNextRequest
1673    {
1674        #[inline(always)]
1675        fn new_empty() -> Self {
1676            Self { start_id: fidl::new_empty!(u64, D), limit: fidl::new_empty!(u32, D) }
1677        }
1678
1679        #[inline]
1680        unsafe fn decode(
1681            &mut self,
1682            decoder: &mut fidl::encoding::Decoder<'_, D>,
1683            offset: usize,
1684            _depth: fidl::encoding::Depth,
1685        ) -> fidl::Result<()> {
1686            decoder.debug_check_bounds::<Self>(offset);
1687            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1688            // Verify that padding bytes are zero.
1689            let ptr = unsafe { buf_ptr.offset(8) };
1690            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1691            let mask = 0xffffffff00000000u64;
1692            let maskedval = padval & mask;
1693            if maskedval != 0 {
1694                return Err(fidl::Error::NonZeroPadding {
1695                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1696                });
1697            }
1698            // Copy from the buffer into the object.
1699            unsafe {
1700                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1701            }
1702            Ok(())
1703        }
1704    }
1705
1706    impl fidl::encoding::ValueTypeMarker for DictionaryEnumerateIteratorGetNextRequest {
1707        type Borrowed<'a> = &'a Self;
1708        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1709            value
1710        }
1711    }
1712
1713    unsafe impl fidl::encoding::TypeMarker for DictionaryEnumerateIteratorGetNextRequest {
1714        type Owned = Self;
1715
1716        #[inline(always)]
1717        fn inline_align(_context: fidl::encoding::Context) -> usize {
1718            8
1719        }
1720
1721        #[inline(always)]
1722        fn inline_size(_context: fidl::encoding::Context) -> usize {
1723            16
1724        }
1725    }
1726
1727    unsafe impl<D: fidl::encoding::ResourceDialect>
1728        fidl::encoding::Encode<DictionaryEnumerateIteratorGetNextRequest, D>
1729        for &DictionaryEnumerateIteratorGetNextRequest
1730    {
1731        #[inline]
1732        unsafe fn encode(
1733            self,
1734            encoder: &mut fidl::encoding::Encoder<'_, D>,
1735            offset: usize,
1736            _depth: fidl::encoding::Depth,
1737        ) -> fidl::Result<()> {
1738            encoder.debug_check_bounds::<DictionaryEnumerateIteratorGetNextRequest>(offset);
1739            unsafe {
1740                // Copy the object into the buffer.
1741                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1742                (buf_ptr as *mut DictionaryEnumerateIteratorGetNextRequest).write_unaligned(
1743                    (self as *const DictionaryEnumerateIteratorGetNextRequest).read(),
1744                );
1745                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1746                // done second because the memcpy will write garbage to these bytes.
1747                let padding_ptr = buf_ptr.offset(8) as *mut u64;
1748                let padding_mask = 0xffffffff00000000u64;
1749                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
1750            }
1751            Ok(())
1752        }
1753    }
1754    unsafe impl<
1755            D: fidl::encoding::ResourceDialect,
1756            T0: fidl::encoding::Encode<u64, D>,
1757            T1: fidl::encoding::Encode<u32, D>,
1758        > fidl::encoding::Encode<DictionaryEnumerateIteratorGetNextRequest, D> for (T0, T1)
1759    {
1760        #[inline]
1761        unsafe fn encode(
1762            self,
1763            encoder: &mut fidl::encoding::Encoder<'_, D>,
1764            offset: usize,
1765            depth: fidl::encoding::Depth,
1766        ) -> fidl::Result<()> {
1767            encoder.debug_check_bounds::<DictionaryEnumerateIteratorGetNextRequest>(offset);
1768            // Zero out padding regions. There's no need to apply masks
1769            // because the unmasked parts will be overwritten by fields.
1770            unsafe {
1771                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1772                (ptr as *mut u64).write_unaligned(0);
1773            }
1774            // Write the fields.
1775            self.0.encode(encoder, offset + 0, depth)?;
1776            self.1.encode(encoder, offset + 8, depth)?;
1777            Ok(())
1778        }
1779    }
1780
1781    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1782        for DictionaryEnumerateIteratorGetNextRequest
1783    {
1784        #[inline(always)]
1785        fn new_empty() -> Self {
1786            Self { start_id: fidl::new_empty!(u64, D), limit: fidl::new_empty!(u32, D) }
1787        }
1788
1789        #[inline]
1790        unsafe fn decode(
1791            &mut self,
1792            decoder: &mut fidl::encoding::Decoder<'_, D>,
1793            offset: usize,
1794            _depth: fidl::encoding::Depth,
1795        ) -> fidl::Result<()> {
1796            decoder.debug_check_bounds::<Self>(offset);
1797            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1798            // Verify that padding bytes are zero.
1799            let ptr = unsafe { buf_ptr.offset(8) };
1800            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1801            let mask = 0xffffffff00000000u64;
1802            let maskedval = padval & mask;
1803            if maskedval != 0 {
1804                return Err(fidl::Error::NonZeroPadding {
1805                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1806                });
1807            }
1808            // Copy from the buffer into the object.
1809            unsafe {
1810                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1811            }
1812            Ok(())
1813        }
1814    }
1815
1816    impl fidl::encoding::ValueTypeMarker for DictionaryItem {
1817        type Borrowed<'a> = &'a Self;
1818        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1819            value
1820        }
1821    }
1822
1823    unsafe impl fidl::encoding::TypeMarker for DictionaryItem {
1824        type Owned = Self;
1825
1826        #[inline(always)]
1827        fn inline_align(_context: fidl::encoding::Context) -> usize {
1828            8
1829        }
1830
1831        #[inline(always)]
1832        fn inline_size(_context: fidl::encoding::Context) -> usize {
1833            24
1834        }
1835    }
1836
1837    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DictionaryItem, D>
1838        for &DictionaryItem
1839    {
1840        #[inline]
1841        unsafe fn encode(
1842            self,
1843            encoder: &mut fidl::encoding::Encoder<'_, D>,
1844            offset: usize,
1845            _depth: fidl::encoding::Depth,
1846        ) -> fidl::Result<()> {
1847            encoder.debug_check_bounds::<DictionaryItem>(offset);
1848            // Delegate to tuple encoding.
1849            fidl::encoding::Encode::<DictionaryItem, D>::encode(
1850                (
1851                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
1852                        &self.key,
1853                    ),
1854                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
1855                ),
1856                encoder,
1857                offset,
1858                _depth,
1859            )
1860        }
1861    }
1862    unsafe impl<
1863            D: fidl::encoding::ResourceDialect,
1864            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
1865            T1: fidl::encoding::Encode<u64, D>,
1866        > fidl::encoding::Encode<DictionaryItem, D> for (T0, T1)
1867    {
1868        #[inline]
1869        unsafe fn encode(
1870            self,
1871            encoder: &mut fidl::encoding::Encoder<'_, D>,
1872            offset: usize,
1873            depth: fidl::encoding::Depth,
1874        ) -> fidl::Result<()> {
1875            encoder.debug_check_bounds::<DictionaryItem>(offset);
1876            // Zero out padding regions. There's no need to apply masks
1877            // because the unmasked parts will be overwritten by fields.
1878            // Write the fields.
1879            self.0.encode(encoder, offset + 0, depth)?;
1880            self.1.encode(encoder, offset + 16, depth)?;
1881            Ok(())
1882        }
1883    }
1884
1885    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DictionaryItem {
1886        #[inline(always)]
1887        fn new_empty() -> Self {
1888            Self {
1889                key: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
1890                value: fidl::new_empty!(u64, D),
1891            }
1892        }
1893
1894        #[inline]
1895        unsafe fn decode(
1896            &mut self,
1897            decoder: &mut fidl::encoding::Decoder<'_, D>,
1898            offset: usize,
1899            _depth: fidl::encoding::Depth,
1900        ) -> fidl::Result<()> {
1901            decoder.debug_check_bounds::<Self>(offset);
1902            // Verify that padding bytes are zero.
1903            fidl::decode!(
1904                fidl::encoding::BoundedString<255>,
1905                D,
1906                &mut self.key,
1907                decoder,
1908                offset + 0,
1909                _depth
1910            )?;
1911            fidl::decode!(u64, D, &mut self.value, decoder, offset + 16, _depth)?;
1912            Ok(())
1913        }
1914    }
1915
1916    impl fidl::encoding::ValueTypeMarker for Unavailable {
1917        type Borrowed<'a> = &'a Self;
1918        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1919            value
1920        }
1921    }
1922
1923    unsafe impl fidl::encoding::TypeMarker for Unavailable {
1924        type Owned = Self;
1925
1926        #[inline(always)]
1927        fn inline_align(_context: fidl::encoding::Context) -> usize {
1928            1
1929        }
1930
1931        #[inline(always)]
1932        fn inline_size(_context: fidl::encoding::Context) -> usize {
1933            1
1934        }
1935    }
1936
1937    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Unavailable, D>
1938        for &Unavailable
1939    {
1940        #[inline]
1941        unsafe fn encode(
1942            self,
1943            encoder: &mut fidl::encoding::Encoder<'_, D>,
1944            offset: usize,
1945            _depth: fidl::encoding::Depth,
1946        ) -> fidl::Result<()> {
1947            encoder.debug_check_bounds::<Unavailable>(offset);
1948            encoder.write_num(0u8, offset);
1949            Ok(())
1950        }
1951    }
1952
1953    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Unavailable {
1954        #[inline(always)]
1955        fn new_empty() -> Self {
1956            Self
1957        }
1958
1959        #[inline]
1960        unsafe fn decode(
1961            &mut self,
1962            decoder: &mut fidl::encoding::Decoder<'_, D>,
1963            offset: usize,
1964            _depth: fidl::encoding::Depth,
1965        ) -> fidl::Result<()> {
1966            decoder.debug_check_bounds::<Self>(offset);
1967            match decoder.read_num::<u8>(offset) {
1968                0 => Ok(()),
1969                _ => Err(fidl::Error::Invalid),
1970            }
1971        }
1972    }
1973
1974    impl fidl::encoding::ValueTypeMarker for Unit {
1975        type Borrowed<'a> = &'a Self;
1976        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1977            value
1978        }
1979    }
1980
1981    unsafe impl fidl::encoding::TypeMarker for Unit {
1982        type Owned = Self;
1983
1984        #[inline(always)]
1985        fn inline_align(_context: fidl::encoding::Context) -> usize {
1986            1
1987        }
1988
1989        #[inline(always)]
1990        fn inline_size(_context: fidl::encoding::Context) -> usize {
1991            1
1992        }
1993    }
1994
1995    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Unit, D> for &Unit {
1996        #[inline]
1997        unsafe fn encode(
1998            self,
1999            encoder: &mut fidl::encoding::Encoder<'_, D>,
2000            offset: usize,
2001            _depth: fidl::encoding::Depth,
2002        ) -> fidl::Result<()> {
2003            encoder.debug_check_bounds::<Unit>(offset);
2004            encoder.write_num(0u8, offset);
2005            Ok(())
2006        }
2007    }
2008
2009    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Unit {
2010        #[inline(always)]
2011        fn new_empty() -> Self {
2012            Self
2013        }
2014
2015        #[inline]
2016        unsafe fn decode(
2017            &mut self,
2018            decoder: &mut fidl::encoding::Decoder<'_, D>,
2019            offset: usize,
2020            _depth: fidl::encoding::Depth,
2021        ) -> fidl::Result<()> {
2022            decoder.debug_check_bounds::<Self>(offset);
2023            match decoder.read_num::<u8>(offset) {
2024                0 => Ok(()),
2025                _ => Err(fidl::Error::Invalid),
2026            }
2027        }
2028    }
2029
2030    impl fidl::encoding::ValueTypeMarker for WrappedCapabilityId {
2031        type Borrowed<'a> = &'a Self;
2032        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2033            value
2034        }
2035    }
2036
2037    unsafe impl fidl::encoding::TypeMarker for WrappedCapabilityId {
2038        type Owned = Self;
2039
2040        #[inline(always)]
2041        fn inline_align(_context: fidl::encoding::Context) -> usize {
2042            8
2043        }
2044
2045        #[inline(always)]
2046        fn inline_size(_context: fidl::encoding::Context) -> usize {
2047            8
2048        }
2049        #[inline(always)]
2050        fn encode_is_copy() -> bool {
2051            true
2052        }
2053
2054        #[inline(always)]
2055        fn decode_is_copy() -> bool {
2056            true
2057        }
2058    }
2059
2060    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WrappedCapabilityId, D>
2061        for &WrappedCapabilityId
2062    {
2063        #[inline]
2064        unsafe fn encode(
2065            self,
2066            encoder: &mut fidl::encoding::Encoder<'_, D>,
2067            offset: usize,
2068            _depth: fidl::encoding::Depth,
2069        ) -> fidl::Result<()> {
2070            encoder.debug_check_bounds::<WrappedCapabilityId>(offset);
2071            unsafe {
2072                // Copy the object into the buffer.
2073                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2074                (buf_ptr as *mut WrappedCapabilityId)
2075                    .write_unaligned((self as *const WrappedCapabilityId).read());
2076                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2077                // done second because the memcpy will write garbage to these bytes.
2078            }
2079            Ok(())
2080        }
2081    }
2082    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2083        fidl::encoding::Encode<WrappedCapabilityId, D> for (T0,)
2084    {
2085        #[inline]
2086        unsafe fn encode(
2087            self,
2088            encoder: &mut fidl::encoding::Encoder<'_, D>,
2089            offset: usize,
2090            depth: fidl::encoding::Depth,
2091        ) -> fidl::Result<()> {
2092            encoder.debug_check_bounds::<WrappedCapabilityId>(offset);
2093            // Zero out padding regions. There's no need to apply masks
2094            // because the unmasked parts will be overwritten by fields.
2095            // Write the fields.
2096            self.0.encode(encoder, offset + 0, depth)?;
2097            Ok(())
2098        }
2099    }
2100
2101    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WrappedCapabilityId {
2102        #[inline(always)]
2103        fn new_empty() -> Self {
2104            Self { id: fidl::new_empty!(u64, D) }
2105        }
2106
2107        #[inline]
2108        unsafe fn decode(
2109            &mut self,
2110            decoder: &mut fidl::encoding::Decoder<'_, D>,
2111            offset: usize,
2112            _depth: fidl::encoding::Depth,
2113        ) -> fidl::Result<()> {
2114            decoder.debug_check_bounds::<Self>(offset);
2115            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2116            // Verify that padding bytes are zero.
2117            // Copy from the buffer into the object.
2118            unsafe {
2119                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2120            }
2121            Ok(())
2122        }
2123    }
2124
2125    impl fidl::encoding::ValueTypeMarker for Data {
2126        type Borrowed<'a> = &'a Self;
2127        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2128            value
2129        }
2130    }
2131
2132    unsafe impl fidl::encoding::TypeMarker for Data {
2133        type Owned = Self;
2134
2135        #[inline(always)]
2136        fn inline_align(_context: fidl::encoding::Context) -> usize {
2137            8
2138        }
2139
2140        #[inline(always)]
2141        fn inline_size(_context: fidl::encoding::Context) -> usize {
2142            16
2143        }
2144    }
2145
2146    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Data, D> for &Data {
2147        #[inline]
2148        unsafe fn encode(
2149            self,
2150            encoder: &mut fidl::encoding::Encoder<'_, D>,
2151            offset: usize,
2152            _depth: fidl::encoding::Depth,
2153        ) -> fidl::Result<()> {
2154            encoder.debug_check_bounds::<Data>(offset);
2155            encoder.write_num::<u64>(self.ordinal(), offset);
2156            match self {
2157            Data::Bytes(ref val) => {
2158                fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<u8, 8192>, D>(
2159                    <fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow(val),
2160                    encoder, offset + 8, _depth
2161                )
2162            }
2163            Data::String(ref val) => {
2164                fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<8192>, D>(
2165                    <fidl::encoding::BoundedString<8192> as fidl::encoding::ValueTypeMarker>::borrow(val),
2166                    encoder, offset + 8, _depth
2167                )
2168            }
2169            Data::Int64(ref val) => {
2170                fidl::encoding::encode_in_envelope::<i64, D>(
2171                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2172                    encoder, offset + 8, _depth
2173                )
2174            }
2175            Data::Uint64(ref val) => {
2176                fidl::encoding::encode_in_envelope::<u64, D>(
2177                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2178                    encoder, offset + 8, _depth
2179                )
2180            }
2181            Data::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2182        }
2183        }
2184    }
2185
2186    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Data {
2187        #[inline(always)]
2188        fn new_empty() -> Self {
2189            Self::__SourceBreaking { unknown_ordinal: 0 }
2190        }
2191
2192        #[inline]
2193        unsafe fn decode(
2194            &mut self,
2195            decoder: &mut fidl::encoding::Decoder<'_, D>,
2196            offset: usize,
2197            mut depth: fidl::encoding::Depth,
2198        ) -> fidl::Result<()> {
2199            decoder.debug_check_bounds::<Self>(offset);
2200            #[allow(unused_variables)]
2201            let next_out_of_line = decoder.next_out_of_line();
2202            let handles_before = decoder.remaining_handles();
2203            let (ordinal, inlined, num_bytes, num_handles) =
2204                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2205
2206            let member_inline_size = match ordinal {
2207                1 => <fidl::encoding::Vector<u8, 8192> as fidl::encoding::TypeMarker>::inline_size(
2208                    decoder.context,
2209                ),
2210                2 => {
2211                    <fidl::encoding::BoundedString<8192> as fidl::encoding::TypeMarker>::inline_size(
2212                        decoder.context,
2213                    )
2214                }
2215                3 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2216                4 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2217                0 => return Err(fidl::Error::UnknownUnionTag),
2218                _ => num_bytes as usize,
2219            };
2220
2221            if inlined != (member_inline_size <= 4) {
2222                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2223            }
2224            let _inner_offset;
2225            if inlined {
2226                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2227                _inner_offset = offset + 8;
2228            } else {
2229                depth.increment()?;
2230                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2231            }
2232            match ordinal {
2233                1 => {
2234                    #[allow(irrefutable_let_patterns)]
2235                    if let Data::Bytes(_) = self {
2236                        // Do nothing, read the value into the object
2237                    } else {
2238                        // Initialize `self` to the right variant
2239                        *self = Data::Bytes(fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, D));
2240                    }
2241                    #[allow(irrefutable_let_patterns)]
2242                    if let Data::Bytes(ref mut val) = self {
2243                        fidl::decode!(fidl::encoding::Vector<u8, 8192>, D, val, decoder, _inner_offset, depth)?;
2244                    } else {
2245                        unreachable!()
2246                    }
2247                }
2248                2 => {
2249                    #[allow(irrefutable_let_patterns)]
2250                    if let Data::String(_) = self {
2251                        // Do nothing, read the value into the object
2252                    } else {
2253                        // Initialize `self` to the right variant
2254                        *self =
2255                            Data::String(fidl::new_empty!(fidl::encoding::BoundedString<8192>, D));
2256                    }
2257                    #[allow(irrefutable_let_patterns)]
2258                    if let Data::String(ref mut val) = self {
2259                        fidl::decode!(
2260                            fidl::encoding::BoundedString<8192>,
2261                            D,
2262                            val,
2263                            decoder,
2264                            _inner_offset,
2265                            depth
2266                        )?;
2267                    } else {
2268                        unreachable!()
2269                    }
2270                }
2271                3 => {
2272                    #[allow(irrefutable_let_patterns)]
2273                    if let Data::Int64(_) = self {
2274                        // Do nothing, read the value into the object
2275                    } else {
2276                        // Initialize `self` to the right variant
2277                        *self = Data::Int64(fidl::new_empty!(i64, D));
2278                    }
2279                    #[allow(irrefutable_let_patterns)]
2280                    if let Data::Int64(ref mut val) = self {
2281                        fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
2282                    } else {
2283                        unreachable!()
2284                    }
2285                }
2286                4 => {
2287                    #[allow(irrefutable_let_patterns)]
2288                    if let Data::Uint64(_) = self {
2289                        // Do nothing, read the value into the object
2290                    } else {
2291                        // Initialize `self` to the right variant
2292                        *self = Data::Uint64(fidl::new_empty!(u64, D));
2293                    }
2294                    #[allow(irrefutable_let_patterns)]
2295                    if let Data::Uint64(ref mut val) = self {
2296                        fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
2297                    } else {
2298                        unreachable!()
2299                    }
2300                }
2301                #[allow(deprecated)]
2302                ordinal => {
2303                    for _ in 0..num_handles {
2304                        decoder.drop_next_handle()?;
2305                    }
2306                    *self = Data::__SourceBreaking { unknown_ordinal: ordinal };
2307                }
2308            }
2309            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2310                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2311            }
2312            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2313                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2314            }
2315            Ok(())
2316        }
2317    }
2318}