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