1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub type CapabilityId = u64;
17
18pub type DictionaryKey = String;
21
22pub type NewCapabilityId = u64;
25
26pub type WrappedNewCapabilityId = WrappedCapabilityId;
27
28pub const MAX_DATA_LENGTH: u32 = 8192;
30
31pub const MAX_DICTIONARY_ITERATOR_CHUNK: u32 = 128;
33
34pub const MAX_NAME_LENGTH: u64 = fidl_fuchsia_io__common::MAX_NAME_LENGTH as u64;
37
38#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
46#[repr(u32)]
47pub enum Availability {
48 Required = 1,
51 Optional = 2,
58 SameAsTarget = 3,
66 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#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
94pub enum CapabilityStoreError {
95 IdNotFound,
97 IdAlreadyExists,
99 BadCapability,
102 WrongType,
104 NotDuplicatable,
107 ItemNotFound,
109 ItemAlreadyExists,
111 InvalidKey,
114 InvalidArgs,
116 #[doc(hidden)]
117 __SourceBreaking { unknown_ordinal: u32 },
118}
119
120#[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#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
193pub enum DictionaryError {
194 NotFound,
196 AlreadyExists,
198 BadCapability,
204 InvalidKey,
207 NotCloneable,
210 #[doc(hidden)]
211 __SourceBreaking { unknown_ordinal: u32 },
212}
213
214#[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 NotFound,
277 InvalidArgs,
279 NotSupported,
281 Internal,
283 #[doc(hidden)]
284 __SourceBreaking { unknown_ordinal: u32 },
285}
286
287#[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#[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#[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#[macro_export]
472macro_rules! DataUnknown {
473 () => {
474 _
475 };
476}
477
478impl 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}
539
540pub mod connector_router_ordinals {
541 pub const ROUTE: u64 = 0x74dbb8bc13730766;
542}
543
544pub mod data_router_ordinals {
545 pub const ROUTE: u64 = 0x2e87dc44dfc53804;
546}
547
548pub mod dictionary_ordinals {}
549
550pub mod dictionary_drain_iterator_ordinals {
551 pub const GET_NEXT: u64 = 0x4f8082ca1ee26061;
552}
553
554pub mod dictionary_enumerate_iterator_ordinals {
555 pub const GET_NEXT: u64 = 0x14f8bc286512f5cf;
556}
557
558pub mod dictionary_keys_iterator_ordinals {
559 pub const GET_NEXT: u64 = 0x453828cbacca7d53;
560}
561
562pub mod dictionary_router_ordinals {
563 pub const ROUTE: u64 = 0x714c65bfe54bd79f;
564}
565
566pub mod dir_connector_router_ordinals {
567 pub const ROUTE: u64 = 0xd7e0f01da2c8e40;
568}
569
570pub mod dir_entry_router_ordinals {
571 pub const ROUTE: u64 = 0x1ac694001c208bd2;
572}
573
574pub mod dir_receiver_ordinals {
575 pub const RECEIVE: u64 = 0xcdc3e9b89fe7bb4;
576}
577
578pub mod directory_router_ordinals {
579 pub const ROUTE: u64 = 0x683b6c6be21b0f21;
580}
581
582pub mod receiver_ordinals {
583 pub const RECEIVE: u64 = 0x4bae18ab7aa1a94;
584}
585
586mod internal {
587 use super::*;
588 unsafe impl fidl::encoding::TypeMarker for Availability {
589 type Owned = Self;
590
591 #[inline(always)]
592 fn inline_align(_context: fidl::encoding::Context) -> usize {
593 std::mem::align_of::<u32>()
594 }
595
596 #[inline(always)]
597 fn inline_size(_context: fidl::encoding::Context) -> usize {
598 std::mem::size_of::<u32>()
599 }
600
601 #[inline(always)]
602 fn encode_is_copy() -> bool {
603 true
604 }
605
606 #[inline(always)]
607 fn decode_is_copy() -> bool {
608 false
609 }
610 }
611
612 impl fidl::encoding::ValueTypeMarker for Availability {
613 type Borrowed<'a> = Self;
614 #[inline(always)]
615 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
616 *value
617 }
618 }
619
620 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Availability {
621 #[inline]
622 unsafe fn encode(
623 self,
624 encoder: &mut fidl::encoding::Encoder<'_, D>,
625 offset: usize,
626 _depth: fidl::encoding::Depth,
627 ) -> fidl::Result<()> {
628 encoder.debug_check_bounds::<Self>(offset);
629 encoder.write_num(self.into_primitive(), offset);
630 Ok(())
631 }
632 }
633
634 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Availability {
635 #[inline(always)]
636 fn new_empty() -> Self {
637 Self::Required
638 }
639
640 #[inline]
641 unsafe fn decode(
642 &mut self,
643 decoder: &mut fidl::encoding::Decoder<'_, D>,
644 offset: usize,
645 _depth: fidl::encoding::Depth,
646 ) -> fidl::Result<()> {
647 decoder.debug_check_bounds::<Self>(offset);
648 let prim = decoder.read_num::<u32>(offset);
649
650 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
651 Ok(())
652 }
653 }
654 unsafe impl fidl::encoding::TypeMarker for CapabilityStoreError {
655 type Owned = Self;
656
657 #[inline(always)]
658 fn inline_align(_context: fidl::encoding::Context) -> usize {
659 std::mem::align_of::<u32>()
660 }
661
662 #[inline(always)]
663 fn inline_size(_context: fidl::encoding::Context) -> usize {
664 std::mem::size_of::<u32>()
665 }
666
667 #[inline(always)]
668 fn encode_is_copy() -> bool {
669 false
670 }
671
672 #[inline(always)]
673 fn decode_is_copy() -> bool {
674 false
675 }
676 }
677
678 impl fidl::encoding::ValueTypeMarker for CapabilityStoreError {
679 type Borrowed<'a> = Self;
680 #[inline(always)]
681 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
682 *value
683 }
684 }
685
686 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
687 for CapabilityStoreError
688 {
689 #[inline]
690 unsafe fn encode(
691 self,
692 encoder: &mut fidl::encoding::Encoder<'_, D>,
693 offset: usize,
694 _depth: fidl::encoding::Depth,
695 ) -> fidl::Result<()> {
696 encoder.debug_check_bounds::<Self>(offset);
697 encoder.write_num(self.into_primitive(), offset);
698 Ok(())
699 }
700 }
701
702 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CapabilityStoreError {
703 #[inline(always)]
704 fn new_empty() -> Self {
705 Self::unknown()
706 }
707
708 #[inline]
709 unsafe fn decode(
710 &mut self,
711 decoder: &mut fidl::encoding::Decoder<'_, D>,
712 offset: usize,
713 _depth: fidl::encoding::Depth,
714 ) -> fidl::Result<()> {
715 decoder.debug_check_bounds::<Self>(offset);
716 let prim = decoder.read_num::<u32>(offset);
717
718 *self = Self::from_primitive_allow_unknown(prim);
719 Ok(())
720 }
721 }
722 unsafe impl fidl::encoding::TypeMarker for DictionaryError {
723 type Owned = Self;
724
725 #[inline(always)]
726 fn inline_align(_context: fidl::encoding::Context) -> usize {
727 std::mem::align_of::<u32>()
728 }
729
730 #[inline(always)]
731 fn inline_size(_context: fidl::encoding::Context) -> usize {
732 std::mem::size_of::<u32>()
733 }
734
735 #[inline(always)]
736 fn encode_is_copy() -> bool {
737 false
738 }
739
740 #[inline(always)]
741 fn decode_is_copy() -> bool {
742 false
743 }
744 }
745
746 impl fidl::encoding::ValueTypeMarker for DictionaryError {
747 type Borrowed<'a> = Self;
748 #[inline(always)]
749 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
750 *value
751 }
752 }
753
754 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
755 for DictionaryError
756 {
757 #[inline]
758 unsafe fn encode(
759 self,
760 encoder: &mut fidl::encoding::Encoder<'_, D>,
761 offset: usize,
762 _depth: fidl::encoding::Depth,
763 ) -> fidl::Result<()> {
764 encoder.debug_check_bounds::<Self>(offset);
765 encoder.write_num(self.into_primitive(), offset);
766 Ok(())
767 }
768 }
769
770 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DictionaryError {
771 #[inline(always)]
772 fn new_empty() -> Self {
773 Self::unknown()
774 }
775
776 #[inline]
777 unsafe fn decode(
778 &mut self,
779 decoder: &mut fidl::encoding::Decoder<'_, D>,
780 offset: usize,
781 _depth: fidl::encoding::Depth,
782 ) -> fidl::Result<()> {
783 decoder.debug_check_bounds::<Self>(offset);
784 let prim = decoder.read_num::<u32>(offset);
785
786 *self = Self::from_primitive_allow_unknown(prim);
787 Ok(())
788 }
789 }
790 unsafe impl fidl::encoding::TypeMarker for RouterError {
791 type Owned = Self;
792
793 #[inline(always)]
794 fn inline_align(_context: fidl::encoding::Context) -> usize {
795 std::mem::align_of::<u32>()
796 }
797
798 #[inline(always)]
799 fn inline_size(_context: fidl::encoding::Context) -> usize {
800 std::mem::size_of::<u32>()
801 }
802
803 #[inline(always)]
804 fn encode_is_copy() -> bool {
805 false
806 }
807
808 #[inline(always)]
809 fn decode_is_copy() -> bool {
810 false
811 }
812 }
813
814 impl fidl::encoding::ValueTypeMarker for RouterError {
815 type Borrowed<'a> = Self;
816 #[inline(always)]
817 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
818 *value
819 }
820 }
821
822 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RouterError {
823 #[inline]
824 unsafe fn encode(
825 self,
826 encoder: &mut fidl::encoding::Encoder<'_, D>,
827 offset: usize,
828 _depth: fidl::encoding::Depth,
829 ) -> fidl::Result<()> {
830 encoder.debug_check_bounds::<Self>(offset);
831 encoder.write_num(self.into_primitive(), offset);
832 Ok(())
833 }
834 }
835
836 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RouterError {
837 #[inline(always)]
838 fn new_empty() -> Self {
839 Self::unknown()
840 }
841
842 #[inline]
843 unsafe fn decode(
844 &mut self,
845 decoder: &mut fidl::encoding::Decoder<'_, D>,
846 offset: usize,
847 _depth: fidl::encoding::Depth,
848 ) -> fidl::Result<()> {
849 decoder.debug_check_bounds::<Self>(offset);
850 let prim = decoder.read_num::<u32>(offset);
851
852 *self = Self::from_primitive_allow_unknown(prim);
853 Ok(())
854 }
855 }
856
857 impl fidl::encoding::ValueTypeMarker for CapabilityStoreDictionaryCopyRequest {
858 type Borrowed<'a> = &'a Self;
859 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
860 value
861 }
862 }
863
864 unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDictionaryCopyRequest {
865 type Owned = Self;
866
867 #[inline(always)]
868 fn inline_align(_context: fidl::encoding::Context) -> usize {
869 8
870 }
871
872 #[inline(always)]
873 fn inline_size(_context: fidl::encoding::Context) -> usize {
874 16
875 }
876 #[inline(always)]
877 fn encode_is_copy() -> bool {
878 true
879 }
880
881 #[inline(always)]
882 fn decode_is_copy() -> bool {
883 true
884 }
885 }
886
887 unsafe impl<D: fidl::encoding::ResourceDialect>
888 fidl::encoding::Encode<CapabilityStoreDictionaryCopyRequest, D>
889 for &CapabilityStoreDictionaryCopyRequest
890 {
891 #[inline]
892 unsafe fn encode(
893 self,
894 encoder: &mut fidl::encoding::Encoder<'_, D>,
895 offset: usize,
896 _depth: fidl::encoding::Depth,
897 ) -> fidl::Result<()> {
898 encoder.debug_check_bounds::<CapabilityStoreDictionaryCopyRequest>(offset);
899 unsafe {
900 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
902 (buf_ptr as *mut CapabilityStoreDictionaryCopyRequest)
903 .write_unaligned((self as *const CapabilityStoreDictionaryCopyRequest).read());
904 }
907 Ok(())
908 }
909 }
910 unsafe impl<
911 D: fidl::encoding::ResourceDialect,
912 T0: fidl::encoding::Encode<u64, D>,
913 T1: fidl::encoding::Encode<u64, D>,
914 > fidl::encoding::Encode<CapabilityStoreDictionaryCopyRequest, D> for (T0, T1)
915 {
916 #[inline]
917 unsafe fn encode(
918 self,
919 encoder: &mut fidl::encoding::Encoder<'_, D>,
920 offset: usize,
921 depth: fidl::encoding::Depth,
922 ) -> fidl::Result<()> {
923 encoder.debug_check_bounds::<CapabilityStoreDictionaryCopyRequest>(offset);
924 self.0.encode(encoder, offset + 0, depth)?;
928 self.1.encode(encoder, offset + 8, depth)?;
929 Ok(())
930 }
931 }
932
933 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
934 for CapabilityStoreDictionaryCopyRequest
935 {
936 #[inline(always)]
937 fn new_empty() -> Self {
938 Self { id: fidl::new_empty!(u64, D), dest_id: fidl::new_empty!(u64, D) }
939 }
940
941 #[inline]
942 unsafe fn decode(
943 &mut self,
944 decoder: &mut fidl::encoding::Decoder<'_, D>,
945 offset: usize,
946 _depth: fidl::encoding::Depth,
947 ) -> fidl::Result<()> {
948 decoder.debug_check_bounds::<Self>(offset);
949 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
950 unsafe {
953 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
954 }
955 Ok(())
956 }
957 }
958
959 impl fidl::encoding::ValueTypeMarker for CapabilityStoreDictionaryCreateRequest {
960 type Borrowed<'a> = &'a Self;
961 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
962 value
963 }
964 }
965
966 unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDictionaryCreateRequest {
967 type Owned = Self;
968
969 #[inline(always)]
970 fn inline_align(_context: fidl::encoding::Context) -> usize {
971 8
972 }
973
974 #[inline(always)]
975 fn inline_size(_context: fidl::encoding::Context) -> usize {
976 8
977 }
978 #[inline(always)]
979 fn encode_is_copy() -> bool {
980 true
981 }
982
983 #[inline(always)]
984 fn decode_is_copy() -> bool {
985 true
986 }
987 }
988
989 unsafe impl<D: fidl::encoding::ResourceDialect>
990 fidl::encoding::Encode<CapabilityStoreDictionaryCreateRequest, D>
991 for &CapabilityStoreDictionaryCreateRequest
992 {
993 #[inline]
994 unsafe fn encode(
995 self,
996 encoder: &mut fidl::encoding::Encoder<'_, D>,
997 offset: usize,
998 _depth: fidl::encoding::Depth,
999 ) -> fidl::Result<()> {
1000 encoder.debug_check_bounds::<CapabilityStoreDictionaryCreateRequest>(offset);
1001 unsafe {
1002 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1004 (buf_ptr as *mut CapabilityStoreDictionaryCreateRequest).write_unaligned(
1005 (self as *const CapabilityStoreDictionaryCreateRequest).read(),
1006 );
1007 }
1010 Ok(())
1011 }
1012 }
1013 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1014 fidl::encoding::Encode<CapabilityStoreDictionaryCreateRequest, D> for (T0,)
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::<CapabilityStoreDictionaryCreateRequest>(offset);
1024 self.0.encode(encoder, offset + 0, depth)?;
1028 Ok(())
1029 }
1030 }
1031
1032 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1033 for CapabilityStoreDictionaryCreateRequest
1034 {
1035 #[inline(always)]
1036 fn new_empty() -> Self {
1037 Self { id: fidl::new_empty!(u64, D) }
1038 }
1039
1040 #[inline]
1041 unsafe fn decode(
1042 &mut self,
1043 decoder: &mut fidl::encoding::Decoder<'_, D>,
1044 offset: usize,
1045 _depth: fidl::encoding::Depth,
1046 ) -> fidl::Result<()> {
1047 decoder.debug_check_bounds::<Self>(offset);
1048 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1049 unsafe {
1052 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1053 }
1054 Ok(())
1055 }
1056 }
1057
1058 impl fidl::encoding::ValueTypeMarker for CapabilityStoreDictionaryGetRequest {
1059 type Borrowed<'a> = &'a Self;
1060 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1061 value
1062 }
1063 }
1064
1065 unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDictionaryGetRequest {
1066 type Owned = Self;
1067
1068 #[inline(always)]
1069 fn inline_align(_context: fidl::encoding::Context) -> usize {
1070 8
1071 }
1072
1073 #[inline(always)]
1074 fn inline_size(_context: fidl::encoding::Context) -> usize {
1075 32
1076 }
1077 }
1078
1079 unsafe impl<D: fidl::encoding::ResourceDialect>
1080 fidl::encoding::Encode<CapabilityStoreDictionaryGetRequest, D>
1081 for &CapabilityStoreDictionaryGetRequest
1082 {
1083 #[inline]
1084 unsafe fn encode(
1085 self,
1086 encoder: &mut fidl::encoding::Encoder<'_, D>,
1087 offset: usize,
1088 _depth: fidl::encoding::Depth,
1089 ) -> fidl::Result<()> {
1090 encoder.debug_check_bounds::<CapabilityStoreDictionaryGetRequest>(offset);
1091 fidl::encoding::Encode::<CapabilityStoreDictionaryGetRequest, D>::encode(
1093 (
1094 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1095 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
1096 &self.key,
1097 ),
1098 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dest_id),
1099 ),
1100 encoder,
1101 offset,
1102 _depth,
1103 )
1104 }
1105 }
1106 unsafe impl<
1107 D: fidl::encoding::ResourceDialect,
1108 T0: fidl::encoding::Encode<u64, D>,
1109 T1: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
1110 T2: fidl::encoding::Encode<u64, D>,
1111 > fidl::encoding::Encode<CapabilityStoreDictionaryGetRequest, D> for (T0, T1, T2)
1112 {
1113 #[inline]
1114 unsafe fn encode(
1115 self,
1116 encoder: &mut fidl::encoding::Encoder<'_, D>,
1117 offset: usize,
1118 depth: fidl::encoding::Depth,
1119 ) -> fidl::Result<()> {
1120 encoder.debug_check_bounds::<CapabilityStoreDictionaryGetRequest>(offset);
1121 self.0.encode(encoder, offset + 0, depth)?;
1125 self.1.encode(encoder, offset + 8, depth)?;
1126 self.2.encode(encoder, offset + 24, depth)?;
1127 Ok(())
1128 }
1129 }
1130
1131 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1132 for CapabilityStoreDictionaryGetRequest
1133 {
1134 #[inline(always)]
1135 fn new_empty() -> Self {
1136 Self {
1137 id: fidl::new_empty!(u64, D),
1138 key: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
1139 dest_id: fidl::new_empty!(u64, D),
1140 }
1141 }
1142
1143 #[inline]
1144 unsafe fn decode(
1145 &mut self,
1146 decoder: &mut fidl::encoding::Decoder<'_, D>,
1147 offset: usize,
1148 _depth: fidl::encoding::Depth,
1149 ) -> fidl::Result<()> {
1150 decoder.debug_check_bounds::<Self>(offset);
1151 fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
1153 fidl::decode!(
1154 fidl::encoding::BoundedString<255>,
1155 D,
1156 &mut self.key,
1157 decoder,
1158 offset + 8,
1159 _depth
1160 )?;
1161 fidl::decode!(u64, D, &mut self.dest_id, decoder, offset + 24, _depth)?;
1162 Ok(())
1163 }
1164 }
1165
1166 impl fidl::encoding::ValueTypeMarker for CapabilityStoreDictionaryInsertRequest {
1167 type Borrowed<'a> = &'a Self;
1168 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1169 value
1170 }
1171 }
1172
1173 unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDictionaryInsertRequest {
1174 type Owned = Self;
1175
1176 #[inline(always)]
1177 fn inline_align(_context: fidl::encoding::Context) -> usize {
1178 8
1179 }
1180
1181 #[inline(always)]
1182 fn inline_size(_context: fidl::encoding::Context) -> usize {
1183 32
1184 }
1185 }
1186
1187 unsafe impl<D: fidl::encoding::ResourceDialect>
1188 fidl::encoding::Encode<CapabilityStoreDictionaryInsertRequest, D>
1189 for &CapabilityStoreDictionaryInsertRequest
1190 {
1191 #[inline]
1192 unsafe fn encode(
1193 self,
1194 encoder: &mut fidl::encoding::Encoder<'_, D>,
1195 offset: usize,
1196 _depth: fidl::encoding::Depth,
1197 ) -> fidl::Result<()> {
1198 encoder.debug_check_bounds::<CapabilityStoreDictionaryInsertRequest>(offset);
1199 fidl::encoding::Encode::<CapabilityStoreDictionaryInsertRequest, D>::encode(
1201 (
1202 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1203 <DictionaryItem as fidl::encoding::ValueTypeMarker>::borrow(&self.item),
1204 ),
1205 encoder,
1206 offset,
1207 _depth,
1208 )
1209 }
1210 }
1211 unsafe impl<
1212 D: fidl::encoding::ResourceDialect,
1213 T0: fidl::encoding::Encode<u64, D>,
1214 T1: fidl::encoding::Encode<DictionaryItem, D>,
1215 > fidl::encoding::Encode<CapabilityStoreDictionaryInsertRequest, D> for (T0, T1)
1216 {
1217 #[inline]
1218 unsafe fn encode(
1219 self,
1220 encoder: &mut fidl::encoding::Encoder<'_, D>,
1221 offset: usize,
1222 depth: fidl::encoding::Depth,
1223 ) -> fidl::Result<()> {
1224 encoder.debug_check_bounds::<CapabilityStoreDictionaryInsertRequest>(offset);
1225 self.0.encode(encoder, offset + 0, depth)?;
1229 self.1.encode(encoder, offset + 8, depth)?;
1230 Ok(())
1231 }
1232 }
1233
1234 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1235 for CapabilityStoreDictionaryInsertRequest
1236 {
1237 #[inline(always)]
1238 fn new_empty() -> Self {
1239 Self { id: fidl::new_empty!(u64, D), item: fidl::new_empty!(DictionaryItem, D) }
1240 }
1241
1242 #[inline]
1243 unsafe fn decode(
1244 &mut self,
1245 decoder: &mut fidl::encoding::Decoder<'_, D>,
1246 offset: usize,
1247 _depth: fidl::encoding::Depth,
1248 ) -> fidl::Result<()> {
1249 decoder.debug_check_bounds::<Self>(offset);
1250 fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
1252 fidl::decode!(DictionaryItem, D, &mut self.item, decoder, offset + 8, _depth)?;
1253 Ok(())
1254 }
1255 }
1256
1257 impl fidl::encoding::ValueTypeMarker for CapabilityStoreDictionaryRemoveRequest {
1258 type Borrowed<'a> = &'a Self;
1259 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1260 value
1261 }
1262 }
1263
1264 unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDictionaryRemoveRequest {
1265 type Owned = Self;
1266
1267 #[inline(always)]
1268 fn inline_align(_context: fidl::encoding::Context) -> usize {
1269 8
1270 }
1271
1272 #[inline(always)]
1273 fn inline_size(_context: fidl::encoding::Context) -> usize {
1274 32
1275 }
1276 }
1277
1278 unsafe impl<D: fidl::encoding::ResourceDialect>
1279 fidl::encoding::Encode<CapabilityStoreDictionaryRemoveRequest, D>
1280 for &CapabilityStoreDictionaryRemoveRequest
1281 {
1282 #[inline]
1283 unsafe fn encode(
1284 self,
1285 encoder: &mut fidl::encoding::Encoder<'_, D>,
1286 offset: usize,
1287 _depth: fidl::encoding::Depth,
1288 ) -> fidl::Result<()> {
1289 encoder.debug_check_bounds::<CapabilityStoreDictionaryRemoveRequest>(offset);
1290 fidl::encoding::Encode::<CapabilityStoreDictionaryRemoveRequest, D>::encode(
1292 (
1293 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1294 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.key),
1295 <fidl::encoding::Boxed<WrappedCapabilityId> as fidl::encoding::ValueTypeMarker>::borrow(&self.dest_id),
1296 ),
1297 encoder, offset, _depth
1298 )
1299 }
1300 }
1301 unsafe impl<
1302 D: fidl::encoding::ResourceDialect,
1303 T0: fidl::encoding::Encode<u64, D>,
1304 T1: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
1305 T2: fidl::encoding::Encode<fidl::encoding::Boxed<WrappedCapabilityId>, D>,
1306 > fidl::encoding::Encode<CapabilityStoreDictionaryRemoveRequest, D> for (T0, T1, T2)
1307 {
1308 #[inline]
1309 unsafe fn encode(
1310 self,
1311 encoder: &mut fidl::encoding::Encoder<'_, D>,
1312 offset: usize,
1313 depth: fidl::encoding::Depth,
1314 ) -> fidl::Result<()> {
1315 encoder.debug_check_bounds::<CapabilityStoreDictionaryRemoveRequest>(offset);
1316 self.0.encode(encoder, offset + 0, depth)?;
1320 self.1.encode(encoder, offset + 8, depth)?;
1321 self.2.encode(encoder, offset + 24, depth)?;
1322 Ok(())
1323 }
1324 }
1325
1326 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1327 for CapabilityStoreDictionaryRemoveRequest
1328 {
1329 #[inline(always)]
1330 fn new_empty() -> Self {
1331 Self {
1332 id: fidl::new_empty!(u64, D),
1333 key: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
1334 dest_id: fidl::new_empty!(fidl::encoding::Boxed<WrappedCapabilityId>, D),
1335 }
1336 }
1337
1338 #[inline]
1339 unsafe fn decode(
1340 &mut self,
1341 decoder: &mut fidl::encoding::Decoder<'_, D>,
1342 offset: usize,
1343 _depth: fidl::encoding::Depth,
1344 ) -> fidl::Result<()> {
1345 decoder.debug_check_bounds::<Self>(offset);
1346 fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
1348 fidl::decode!(
1349 fidl::encoding::BoundedString<255>,
1350 D,
1351 &mut self.key,
1352 decoder,
1353 offset + 8,
1354 _depth
1355 )?;
1356 fidl::decode!(
1357 fidl::encoding::Boxed<WrappedCapabilityId>,
1358 D,
1359 &mut self.dest_id,
1360 decoder,
1361 offset + 24,
1362 _depth
1363 )?;
1364 Ok(())
1365 }
1366 }
1367
1368 impl fidl::encoding::ValueTypeMarker for CapabilityStoreDropRequest {
1369 type Borrowed<'a> = &'a Self;
1370 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1371 value
1372 }
1373 }
1374
1375 unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDropRequest {
1376 type Owned = Self;
1377
1378 #[inline(always)]
1379 fn inline_align(_context: fidl::encoding::Context) -> usize {
1380 8
1381 }
1382
1383 #[inline(always)]
1384 fn inline_size(_context: fidl::encoding::Context) -> usize {
1385 8
1386 }
1387 #[inline(always)]
1388 fn encode_is_copy() -> bool {
1389 true
1390 }
1391
1392 #[inline(always)]
1393 fn decode_is_copy() -> bool {
1394 true
1395 }
1396 }
1397
1398 unsafe impl<D: fidl::encoding::ResourceDialect>
1399 fidl::encoding::Encode<CapabilityStoreDropRequest, D> for &CapabilityStoreDropRequest
1400 {
1401 #[inline]
1402 unsafe fn encode(
1403 self,
1404 encoder: &mut fidl::encoding::Encoder<'_, D>,
1405 offset: usize,
1406 _depth: fidl::encoding::Depth,
1407 ) -> fidl::Result<()> {
1408 encoder.debug_check_bounds::<CapabilityStoreDropRequest>(offset);
1409 unsafe {
1410 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1412 (buf_ptr as *mut CapabilityStoreDropRequest)
1413 .write_unaligned((self as *const CapabilityStoreDropRequest).read());
1414 }
1417 Ok(())
1418 }
1419 }
1420 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1421 fidl::encoding::Encode<CapabilityStoreDropRequest, D> for (T0,)
1422 {
1423 #[inline]
1424 unsafe fn encode(
1425 self,
1426 encoder: &mut fidl::encoding::Encoder<'_, D>,
1427 offset: usize,
1428 depth: fidl::encoding::Depth,
1429 ) -> fidl::Result<()> {
1430 encoder.debug_check_bounds::<CapabilityStoreDropRequest>(offset);
1431 self.0.encode(encoder, offset + 0, depth)?;
1435 Ok(())
1436 }
1437 }
1438
1439 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1440 for CapabilityStoreDropRequest
1441 {
1442 #[inline(always)]
1443 fn new_empty() -> Self {
1444 Self { id: fidl::new_empty!(u64, D) }
1445 }
1446
1447 #[inline]
1448 unsafe fn decode(
1449 &mut self,
1450 decoder: &mut fidl::encoding::Decoder<'_, D>,
1451 offset: usize,
1452 _depth: fidl::encoding::Depth,
1453 ) -> fidl::Result<()> {
1454 decoder.debug_check_bounds::<Self>(offset);
1455 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1456 unsafe {
1459 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1460 }
1461 Ok(())
1462 }
1463 }
1464
1465 impl fidl::encoding::ValueTypeMarker for CapabilityStoreDuplicateRequest {
1466 type Borrowed<'a> = &'a Self;
1467 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1468 value
1469 }
1470 }
1471
1472 unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDuplicateRequest {
1473 type Owned = Self;
1474
1475 #[inline(always)]
1476 fn inline_align(_context: fidl::encoding::Context) -> usize {
1477 8
1478 }
1479
1480 #[inline(always)]
1481 fn inline_size(_context: fidl::encoding::Context) -> usize {
1482 16
1483 }
1484 #[inline(always)]
1485 fn encode_is_copy() -> bool {
1486 true
1487 }
1488
1489 #[inline(always)]
1490 fn decode_is_copy() -> bool {
1491 true
1492 }
1493 }
1494
1495 unsafe impl<D: fidl::encoding::ResourceDialect>
1496 fidl::encoding::Encode<CapabilityStoreDuplicateRequest, D>
1497 for &CapabilityStoreDuplicateRequest
1498 {
1499 #[inline]
1500 unsafe fn encode(
1501 self,
1502 encoder: &mut fidl::encoding::Encoder<'_, D>,
1503 offset: usize,
1504 _depth: fidl::encoding::Depth,
1505 ) -> fidl::Result<()> {
1506 encoder.debug_check_bounds::<CapabilityStoreDuplicateRequest>(offset);
1507 unsafe {
1508 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1510 (buf_ptr as *mut CapabilityStoreDuplicateRequest)
1511 .write_unaligned((self as *const CapabilityStoreDuplicateRequest).read());
1512 }
1515 Ok(())
1516 }
1517 }
1518 unsafe impl<
1519 D: fidl::encoding::ResourceDialect,
1520 T0: fidl::encoding::Encode<u64, D>,
1521 T1: fidl::encoding::Encode<u64, D>,
1522 > fidl::encoding::Encode<CapabilityStoreDuplicateRequest, D> for (T0, T1)
1523 {
1524 #[inline]
1525 unsafe fn encode(
1526 self,
1527 encoder: &mut fidl::encoding::Encoder<'_, D>,
1528 offset: usize,
1529 depth: fidl::encoding::Depth,
1530 ) -> fidl::Result<()> {
1531 encoder.debug_check_bounds::<CapabilityStoreDuplicateRequest>(offset);
1532 self.0.encode(encoder, offset + 0, depth)?;
1536 self.1.encode(encoder, offset + 8, depth)?;
1537 Ok(())
1538 }
1539 }
1540
1541 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1542 for CapabilityStoreDuplicateRequest
1543 {
1544 #[inline(always)]
1545 fn new_empty() -> Self {
1546 Self { id: fidl::new_empty!(u64, D), dest_id: fidl::new_empty!(u64, D) }
1547 }
1548
1549 #[inline]
1550 unsafe fn decode(
1551 &mut self,
1552 decoder: &mut fidl::encoding::Decoder<'_, D>,
1553 offset: usize,
1554 _depth: fidl::encoding::Depth,
1555 ) -> fidl::Result<()> {
1556 decoder.debug_check_bounds::<Self>(offset);
1557 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1558 unsafe {
1561 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1562 }
1563 Ok(())
1564 }
1565 }
1566
1567 impl fidl::encoding::ValueTypeMarker for CapabilityStoreExportRequest {
1568 type Borrowed<'a> = &'a Self;
1569 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1570 value
1571 }
1572 }
1573
1574 unsafe impl fidl::encoding::TypeMarker for CapabilityStoreExportRequest {
1575 type Owned = Self;
1576
1577 #[inline(always)]
1578 fn inline_align(_context: fidl::encoding::Context) -> usize {
1579 8
1580 }
1581
1582 #[inline(always)]
1583 fn inline_size(_context: fidl::encoding::Context) -> usize {
1584 8
1585 }
1586 #[inline(always)]
1587 fn encode_is_copy() -> bool {
1588 true
1589 }
1590
1591 #[inline(always)]
1592 fn decode_is_copy() -> bool {
1593 true
1594 }
1595 }
1596
1597 unsafe impl<D: fidl::encoding::ResourceDialect>
1598 fidl::encoding::Encode<CapabilityStoreExportRequest, D> for &CapabilityStoreExportRequest
1599 {
1600 #[inline]
1601 unsafe fn encode(
1602 self,
1603 encoder: &mut fidl::encoding::Encoder<'_, D>,
1604 offset: usize,
1605 _depth: fidl::encoding::Depth,
1606 ) -> fidl::Result<()> {
1607 encoder.debug_check_bounds::<CapabilityStoreExportRequest>(offset);
1608 unsafe {
1609 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1611 (buf_ptr as *mut CapabilityStoreExportRequest)
1612 .write_unaligned((self as *const CapabilityStoreExportRequest).read());
1613 }
1616 Ok(())
1617 }
1618 }
1619 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1620 fidl::encoding::Encode<CapabilityStoreExportRequest, D> for (T0,)
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::<CapabilityStoreExportRequest>(offset);
1630 self.0.encode(encoder, offset + 0, depth)?;
1634 Ok(())
1635 }
1636 }
1637
1638 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1639 for CapabilityStoreExportRequest
1640 {
1641 #[inline(always)]
1642 fn new_empty() -> Self {
1643 Self { id: fidl::new_empty!(u64, D) }
1644 }
1645
1646 #[inline]
1647 unsafe fn decode(
1648 &mut self,
1649 decoder: &mut fidl::encoding::Decoder<'_, D>,
1650 offset: usize,
1651 _depth: fidl::encoding::Depth,
1652 ) -> fidl::Result<()> {
1653 decoder.debug_check_bounds::<Self>(offset);
1654 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1655 unsafe {
1658 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1659 }
1660 Ok(())
1661 }
1662 }
1663
1664 impl fidl::encoding::ValueTypeMarker for DictionaryDrainIteratorGetNextRequest {
1665 type Borrowed<'a> = &'a Self;
1666 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1667 value
1668 }
1669 }
1670
1671 unsafe impl fidl::encoding::TypeMarker for DictionaryDrainIteratorGetNextRequest {
1672 type Owned = Self;
1673
1674 #[inline(always)]
1675 fn inline_align(_context: fidl::encoding::Context) -> usize {
1676 8
1677 }
1678
1679 #[inline(always)]
1680 fn inline_size(_context: fidl::encoding::Context) -> usize {
1681 16
1682 }
1683 }
1684
1685 unsafe impl<D: fidl::encoding::ResourceDialect>
1686 fidl::encoding::Encode<DictionaryDrainIteratorGetNextRequest, D>
1687 for &DictionaryDrainIteratorGetNextRequest
1688 {
1689 #[inline]
1690 unsafe fn encode(
1691 self,
1692 encoder: &mut fidl::encoding::Encoder<'_, D>,
1693 offset: usize,
1694 _depth: fidl::encoding::Depth,
1695 ) -> fidl::Result<()> {
1696 encoder.debug_check_bounds::<DictionaryDrainIteratorGetNextRequest>(offset);
1697 unsafe {
1698 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1700 (buf_ptr as *mut DictionaryDrainIteratorGetNextRequest)
1701 .write_unaligned((self as *const DictionaryDrainIteratorGetNextRequest).read());
1702 let padding_ptr = buf_ptr.offset(8) as *mut u64;
1705 let padding_mask = 0xffffffff00000000u64;
1706 padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
1707 }
1708 Ok(())
1709 }
1710 }
1711 unsafe impl<
1712 D: fidl::encoding::ResourceDialect,
1713 T0: fidl::encoding::Encode<u64, D>,
1714 T1: fidl::encoding::Encode<u32, D>,
1715 > fidl::encoding::Encode<DictionaryDrainIteratorGetNextRequest, D> for (T0, T1)
1716 {
1717 #[inline]
1718 unsafe fn encode(
1719 self,
1720 encoder: &mut fidl::encoding::Encoder<'_, D>,
1721 offset: usize,
1722 depth: fidl::encoding::Depth,
1723 ) -> fidl::Result<()> {
1724 encoder.debug_check_bounds::<DictionaryDrainIteratorGetNextRequest>(offset);
1725 unsafe {
1728 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1729 (ptr as *mut u64).write_unaligned(0);
1730 }
1731 self.0.encode(encoder, offset + 0, depth)?;
1733 self.1.encode(encoder, offset + 8, depth)?;
1734 Ok(())
1735 }
1736 }
1737
1738 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1739 for DictionaryDrainIteratorGetNextRequest
1740 {
1741 #[inline(always)]
1742 fn new_empty() -> Self {
1743 Self { start_id: fidl::new_empty!(u64, D), limit: fidl::new_empty!(u32, D) }
1744 }
1745
1746 #[inline]
1747 unsafe fn decode(
1748 &mut self,
1749 decoder: &mut fidl::encoding::Decoder<'_, D>,
1750 offset: usize,
1751 _depth: fidl::encoding::Depth,
1752 ) -> fidl::Result<()> {
1753 decoder.debug_check_bounds::<Self>(offset);
1754 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1755 let ptr = unsafe { buf_ptr.offset(8) };
1757 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1758 let mask = 0xffffffff00000000u64;
1759 let maskedval = padval & mask;
1760 if maskedval != 0 {
1761 return Err(fidl::Error::NonZeroPadding {
1762 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1763 });
1764 }
1765 unsafe {
1767 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1768 }
1769 Ok(())
1770 }
1771 }
1772
1773 impl fidl::encoding::ValueTypeMarker for DictionaryEnumerateIteratorGetNextRequest {
1774 type Borrowed<'a> = &'a Self;
1775 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1776 value
1777 }
1778 }
1779
1780 unsafe impl fidl::encoding::TypeMarker for DictionaryEnumerateIteratorGetNextRequest {
1781 type Owned = Self;
1782
1783 #[inline(always)]
1784 fn inline_align(_context: fidl::encoding::Context) -> usize {
1785 8
1786 }
1787
1788 #[inline(always)]
1789 fn inline_size(_context: fidl::encoding::Context) -> usize {
1790 16
1791 }
1792 }
1793
1794 unsafe impl<D: fidl::encoding::ResourceDialect>
1795 fidl::encoding::Encode<DictionaryEnumerateIteratorGetNextRequest, D>
1796 for &DictionaryEnumerateIteratorGetNextRequest
1797 {
1798 #[inline]
1799 unsafe fn encode(
1800 self,
1801 encoder: &mut fidl::encoding::Encoder<'_, D>,
1802 offset: usize,
1803 _depth: fidl::encoding::Depth,
1804 ) -> fidl::Result<()> {
1805 encoder.debug_check_bounds::<DictionaryEnumerateIteratorGetNextRequest>(offset);
1806 unsafe {
1807 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1809 (buf_ptr as *mut DictionaryEnumerateIteratorGetNextRequest).write_unaligned(
1810 (self as *const DictionaryEnumerateIteratorGetNextRequest).read(),
1811 );
1812 let padding_ptr = buf_ptr.offset(8) as *mut u64;
1815 let padding_mask = 0xffffffff00000000u64;
1816 padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
1817 }
1818 Ok(())
1819 }
1820 }
1821 unsafe impl<
1822 D: fidl::encoding::ResourceDialect,
1823 T0: fidl::encoding::Encode<u64, D>,
1824 T1: fidl::encoding::Encode<u32, D>,
1825 > fidl::encoding::Encode<DictionaryEnumerateIteratorGetNextRequest, D> for (T0, T1)
1826 {
1827 #[inline]
1828 unsafe fn encode(
1829 self,
1830 encoder: &mut fidl::encoding::Encoder<'_, D>,
1831 offset: usize,
1832 depth: fidl::encoding::Depth,
1833 ) -> fidl::Result<()> {
1834 encoder.debug_check_bounds::<DictionaryEnumerateIteratorGetNextRequest>(offset);
1835 unsafe {
1838 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1839 (ptr as *mut u64).write_unaligned(0);
1840 }
1841 self.0.encode(encoder, offset + 0, depth)?;
1843 self.1.encode(encoder, offset + 8, depth)?;
1844 Ok(())
1845 }
1846 }
1847
1848 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1849 for DictionaryEnumerateIteratorGetNextRequest
1850 {
1851 #[inline(always)]
1852 fn new_empty() -> Self {
1853 Self { start_id: fidl::new_empty!(u64, D), limit: fidl::new_empty!(u32, D) }
1854 }
1855
1856 #[inline]
1857 unsafe fn decode(
1858 &mut self,
1859 decoder: &mut fidl::encoding::Decoder<'_, D>,
1860 offset: usize,
1861 _depth: fidl::encoding::Depth,
1862 ) -> fidl::Result<()> {
1863 decoder.debug_check_bounds::<Self>(offset);
1864 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1865 let ptr = unsafe { buf_ptr.offset(8) };
1867 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1868 let mask = 0xffffffff00000000u64;
1869 let maskedval = padval & mask;
1870 if maskedval != 0 {
1871 return Err(fidl::Error::NonZeroPadding {
1872 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1873 });
1874 }
1875 unsafe {
1877 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1878 }
1879 Ok(())
1880 }
1881 }
1882
1883 impl fidl::encoding::ValueTypeMarker for DictionaryItem {
1884 type Borrowed<'a> = &'a Self;
1885 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1886 value
1887 }
1888 }
1889
1890 unsafe impl fidl::encoding::TypeMarker for DictionaryItem {
1891 type Owned = Self;
1892
1893 #[inline(always)]
1894 fn inline_align(_context: fidl::encoding::Context) -> usize {
1895 8
1896 }
1897
1898 #[inline(always)]
1899 fn inline_size(_context: fidl::encoding::Context) -> usize {
1900 24
1901 }
1902 }
1903
1904 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DictionaryItem, D>
1905 for &DictionaryItem
1906 {
1907 #[inline]
1908 unsafe fn encode(
1909 self,
1910 encoder: &mut fidl::encoding::Encoder<'_, D>,
1911 offset: usize,
1912 _depth: fidl::encoding::Depth,
1913 ) -> fidl::Result<()> {
1914 encoder.debug_check_bounds::<DictionaryItem>(offset);
1915 fidl::encoding::Encode::<DictionaryItem, D>::encode(
1917 (
1918 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
1919 &self.key,
1920 ),
1921 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
1922 ),
1923 encoder,
1924 offset,
1925 _depth,
1926 )
1927 }
1928 }
1929 unsafe impl<
1930 D: fidl::encoding::ResourceDialect,
1931 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
1932 T1: fidl::encoding::Encode<u64, D>,
1933 > fidl::encoding::Encode<DictionaryItem, D> for (T0, T1)
1934 {
1935 #[inline]
1936 unsafe fn encode(
1937 self,
1938 encoder: &mut fidl::encoding::Encoder<'_, D>,
1939 offset: usize,
1940 depth: fidl::encoding::Depth,
1941 ) -> fidl::Result<()> {
1942 encoder.debug_check_bounds::<DictionaryItem>(offset);
1943 self.0.encode(encoder, offset + 0, depth)?;
1947 self.1.encode(encoder, offset + 16, depth)?;
1948 Ok(())
1949 }
1950 }
1951
1952 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DictionaryItem {
1953 #[inline(always)]
1954 fn new_empty() -> Self {
1955 Self {
1956 key: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
1957 value: fidl::new_empty!(u64, D),
1958 }
1959 }
1960
1961 #[inline]
1962 unsafe fn decode(
1963 &mut self,
1964 decoder: &mut fidl::encoding::Decoder<'_, D>,
1965 offset: usize,
1966 _depth: fidl::encoding::Depth,
1967 ) -> fidl::Result<()> {
1968 decoder.debug_check_bounds::<Self>(offset);
1969 fidl::decode!(
1971 fidl::encoding::BoundedString<255>,
1972 D,
1973 &mut self.key,
1974 decoder,
1975 offset + 0,
1976 _depth
1977 )?;
1978 fidl::decode!(u64, D, &mut self.value, decoder, offset + 16, _depth)?;
1979 Ok(())
1980 }
1981 }
1982
1983 impl fidl::encoding::ValueTypeMarker for Unavailable {
1984 type Borrowed<'a> = &'a Self;
1985 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1986 value
1987 }
1988 }
1989
1990 unsafe impl fidl::encoding::TypeMarker for Unavailable {
1991 type Owned = Self;
1992
1993 #[inline(always)]
1994 fn inline_align(_context: fidl::encoding::Context) -> usize {
1995 1
1996 }
1997
1998 #[inline(always)]
1999 fn inline_size(_context: fidl::encoding::Context) -> usize {
2000 1
2001 }
2002 }
2003
2004 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Unavailable, D>
2005 for &Unavailable
2006 {
2007 #[inline]
2008 unsafe fn encode(
2009 self,
2010 encoder: &mut fidl::encoding::Encoder<'_, D>,
2011 offset: usize,
2012 _depth: fidl::encoding::Depth,
2013 ) -> fidl::Result<()> {
2014 encoder.debug_check_bounds::<Unavailable>(offset);
2015 encoder.write_num(0u8, offset);
2016 Ok(())
2017 }
2018 }
2019
2020 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Unavailable {
2021 #[inline(always)]
2022 fn new_empty() -> Self {
2023 Self
2024 }
2025
2026 #[inline]
2027 unsafe fn decode(
2028 &mut self,
2029 decoder: &mut fidl::encoding::Decoder<'_, D>,
2030 offset: usize,
2031 _depth: fidl::encoding::Depth,
2032 ) -> fidl::Result<()> {
2033 decoder.debug_check_bounds::<Self>(offset);
2034 match decoder.read_num::<u8>(offset) {
2035 0 => Ok(()),
2036 _ => Err(fidl::Error::Invalid),
2037 }
2038 }
2039 }
2040
2041 impl fidl::encoding::ValueTypeMarker for Unit {
2042 type Borrowed<'a> = &'a Self;
2043 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2044 value
2045 }
2046 }
2047
2048 unsafe impl fidl::encoding::TypeMarker for Unit {
2049 type Owned = Self;
2050
2051 #[inline(always)]
2052 fn inline_align(_context: fidl::encoding::Context) -> usize {
2053 1
2054 }
2055
2056 #[inline(always)]
2057 fn inline_size(_context: fidl::encoding::Context) -> usize {
2058 1
2059 }
2060 }
2061
2062 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Unit, D> for &Unit {
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::<Unit>(offset);
2071 encoder.write_num(0u8, offset);
2072 Ok(())
2073 }
2074 }
2075
2076 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Unit {
2077 #[inline(always)]
2078 fn new_empty() -> Self {
2079 Self
2080 }
2081
2082 #[inline]
2083 unsafe fn decode(
2084 &mut self,
2085 decoder: &mut fidl::encoding::Decoder<'_, D>,
2086 offset: usize,
2087 _depth: fidl::encoding::Depth,
2088 ) -> fidl::Result<()> {
2089 decoder.debug_check_bounds::<Self>(offset);
2090 match decoder.read_num::<u8>(offset) {
2091 0 => Ok(()),
2092 _ => Err(fidl::Error::Invalid),
2093 }
2094 }
2095 }
2096
2097 impl fidl::encoding::ValueTypeMarker for WrappedCapabilityId {
2098 type Borrowed<'a> = &'a Self;
2099 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2100 value
2101 }
2102 }
2103
2104 unsafe impl fidl::encoding::TypeMarker for WrappedCapabilityId {
2105 type Owned = Self;
2106
2107 #[inline(always)]
2108 fn inline_align(_context: fidl::encoding::Context) -> usize {
2109 8
2110 }
2111
2112 #[inline(always)]
2113 fn inline_size(_context: fidl::encoding::Context) -> usize {
2114 8
2115 }
2116 #[inline(always)]
2117 fn encode_is_copy() -> bool {
2118 true
2119 }
2120
2121 #[inline(always)]
2122 fn decode_is_copy() -> bool {
2123 true
2124 }
2125 }
2126
2127 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WrappedCapabilityId, D>
2128 for &WrappedCapabilityId
2129 {
2130 #[inline]
2131 unsafe fn encode(
2132 self,
2133 encoder: &mut fidl::encoding::Encoder<'_, D>,
2134 offset: usize,
2135 _depth: fidl::encoding::Depth,
2136 ) -> fidl::Result<()> {
2137 encoder.debug_check_bounds::<WrappedCapabilityId>(offset);
2138 unsafe {
2139 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2141 (buf_ptr as *mut WrappedCapabilityId)
2142 .write_unaligned((self as *const WrappedCapabilityId).read());
2143 }
2146 Ok(())
2147 }
2148 }
2149 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2150 fidl::encoding::Encode<WrappedCapabilityId, D> for (T0,)
2151 {
2152 #[inline]
2153 unsafe fn encode(
2154 self,
2155 encoder: &mut fidl::encoding::Encoder<'_, D>,
2156 offset: usize,
2157 depth: fidl::encoding::Depth,
2158 ) -> fidl::Result<()> {
2159 encoder.debug_check_bounds::<WrappedCapabilityId>(offset);
2160 self.0.encode(encoder, offset + 0, depth)?;
2164 Ok(())
2165 }
2166 }
2167
2168 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WrappedCapabilityId {
2169 #[inline(always)]
2170 fn new_empty() -> Self {
2171 Self { id: fidl::new_empty!(u64, D) }
2172 }
2173
2174 #[inline]
2175 unsafe fn decode(
2176 &mut self,
2177 decoder: &mut fidl::encoding::Decoder<'_, D>,
2178 offset: usize,
2179 _depth: fidl::encoding::Depth,
2180 ) -> fidl::Result<()> {
2181 decoder.debug_check_bounds::<Self>(offset);
2182 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2183 unsafe {
2186 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2187 }
2188 Ok(())
2189 }
2190 }
2191
2192 impl fidl::encoding::ValueTypeMarker for Data {
2193 type Borrowed<'a> = &'a Self;
2194 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2195 value
2196 }
2197 }
2198
2199 unsafe impl fidl::encoding::TypeMarker for Data {
2200 type Owned = Self;
2201
2202 #[inline(always)]
2203 fn inline_align(_context: fidl::encoding::Context) -> usize {
2204 8
2205 }
2206
2207 #[inline(always)]
2208 fn inline_size(_context: fidl::encoding::Context) -> usize {
2209 16
2210 }
2211 }
2212
2213 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Data, D> for &Data {
2214 #[inline]
2215 unsafe fn encode(
2216 self,
2217 encoder: &mut fidl::encoding::Encoder<'_, D>,
2218 offset: usize,
2219 _depth: fidl::encoding::Depth,
2220 ) -> fidl::Result<()> {
2221 encoder.debug_check_bounds::<Data>(offset);
2222 encoder.write_num::<u64>(self.ordinal(), offset);
2223 match self {
2224 Data::Bytes(ref val) => {
2225 fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<u8, 8192>, D>(
2226 <fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow(val),
2227 encoder, offset + 8, _depth
2228 )
2229 }
2230 Data::String(ref val) => {
2231 fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<8192>, D>(
2232 <fidl::encoding::BoundedString<8192> as fidl::encoding::ValueTypeMarker>::borrow(val),
2233 encoder, offset + 8, _depth
2234 )
2235 }
2236 Data::Int64(ref val) => {
2237 fidl::encoding::encode_in_envelope::<i64, D>(
2238 <i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2239 encoder, offset + 8, _depth
2240 )
2241 }
2242 Data::Uint64(ref val) => {
2243 fidl::encoding::encode_in_envelope::<u64, D>(
2244 <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2245 encoder, offset + 8, _depth
2246 )
2247 }
2248 Data::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2249 }
2250 }
2251 }
2252
2253 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Data {
2254 #[inline(always)]
2255 fn new_empty() -> Self {
2256 Self::__SourceBreaking { unknown_ordinal: 0 }
2257 }
2258
2259 #[inline]
2260 unsafe fn decode(
2261 &mut self,
2262 decoder: &mut fidl::encoding::Decoder<'_, D>,
2263 offset: usize,
2264 mut depth: fidl::encoding::Depth,
2265 ) -> fidl::Result<()> {
2266 decoder.debug_check_bounds::<Self>(offset);
2267 #[allow(unused_variables)]
2268 let next_out_of_line = decoder.next_out_of_line();
2269 let handles_before = decoder.remaining_handles();
2270 let (ordinal, inlined, num_bytes, num_handles) =
2271 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2272
2273 let member_inline_size = match ordinal {
2274 1 => <fidl::encoding::Vector<u8, 8192> as fidl::encoding::TypeMarker>::inline_size(
2275 decoder.context,
2276 ),
2277 2 => {
2278 <fidl::encoding::BoundedString<8192> as fidl::encoding::TypeMarker>::inline_size(
2279 decoder.context,
2280 )
2281 }
2282 3 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2283 4 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2284 0 => return Err(fidl::Error::UnknownUnionTag),
2285 _ => num_bytes as usize,
2286 };
2287
2288 if inlined != (member_inline_size <= 4) {
2289 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2290 }
2291 let _inner_offset;
2292 if inlined {
2293 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2294 _inner_offset = offset + 8;
2295 } else {
2296 depth.increment()?;
2297 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2298 }
2299 match ordinal {
2300 1 => {
2301 #[allow(irrefutable_let_patterns)]
2302 if let Data::Bytes(_) = self {
2303 } else {
2305 *self = Data::Bytes(fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, D));
2307 }
2308 #[allow(irrefutable_let_patterns)]
2309 if let Data::Bytes(ref mut val) = self {
2310 fidl::decode!(fidl::encoding::Vector<u8, 8192>, D, val, decoder, _inner_offset, depth)?;
2311 } else {
2312 unreachable!()
2313 }
2314 }
2315 2 => {
2316 #[allow(irrefutable_let_patterns)]
2317 if let Data::String(_) = self {
2318 } else {
2320 *self =
2322 Data::String(fidl::new_empty!(fidl::encoding::BoundedString<8192>, D));
2323 }
2324 #[allow(irrefutable_let_patterns)]
2325 if let Data::String(ref mut val) = self {
2326 fidl::decode!(
2327 fidl::encoding::BoundedString<8192>,
2328 D,
2329 val,
2330 decoder,
2331 _inner_offset,
2332 depth
2333 )?;
2334 } else {
2335 unreachable!()
2336 }
2337 }
2338 3 => {
2339 #[allow(irrefutable_let_patterns)]
2340 if let Data::Int64(_) = self {
2341 } else {
2343 *self = Data::Int64(fidl::new_empty!(i64, D));
2345 }
2346 #[allow(irrefutable_let_patterns)]
2347 if let Data::Int64(ref mut val) = self {
2348 fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
2349 } else {
2350 unreachable!()
2351 }
2352 }
2353 4 => {
2354 #[allow(irrefutable_let_patterns)]
2355 if let Data::Uint64(_) = self {
2356 } else {
2358 *self = Data::Uint64(fidl::new_empty!(u64, D));
2360 }
2361 #[allow(irrefutable_let_patterns)]
2362 if let Data::Uint64(ref mut val) = self {
2363 fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
2364 } else {
2365 unreachable!()
2366 }
2367 }
2368 #[allow(deprecated)]
2369 ordinal => {
2370 for _ in 0..num_handles {
2371 decoder.drop_next_handle()?;
2372 }
2373 *self = Data::__SourceBreaking { unknown_ordinal: ordinal };
2374 }
2375 }
2376 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2377 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2378 }
2379 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2380 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2381 }
2382 Ok(())
2383 }
2384 }
2385}