fidl_fuchsia_space__common/
fidl_fuchsia_space__common.rs1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
12#[repr(u32)]
13pub enum ErrorCode {
14 Internal = 1,
15 PendingCommit = 2,
20}
21
22impl ErrorCode {
23 #[inline]
24 pub fn from_primitive(prim: u32) -> Option<Self> {
25 match prim {
26 1 => Some(Self::Internal),
27 2 => Some(Self::PendingCommit),
28 _ => None,
29 }
30 }
31
32 #[inline]
33 pub const fn into_primitive(self) -> u32 {
34 self as u32
35 }
36}
37
38pub mod manager_ordinals {
39 pub const GC: u64 = 0x12d46337a61ddb45;
40}
41
42mod internal {
43 use super::*;
44 unsafe impl fidl::encoding::TypeMarker for ErrorCode {
45 type Owned = Self;
46
47 #[inline(always)]
48 fn inline_align(_context: fidl::encoding::Context) -> usize {
49 std::mem::align_of::<u32>()
50 }
51
52 #[inline(always)]
53 fn inline_size(_context: fidl::encoding::Context) -> usize {
54 std::mem::size_of::<u32>()
55 }
56
57 #[inline(always)]
58 fn encode_is_copy() -> bool {
59 true
60 }
61
62 #[inline(always)]
63 fn decode_is_copy() -> bool {
64 false
65 }
66 }
67
68 impl fidl::encoding::ValueTypeMarker for ErrorCode {
69 type Borrowed<'a> = Self;
70 #[inline(always)]
71 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
72 *value
73 }
74 }
75
76 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ErrorCode {
77 #[inline]
78 unsafe fn encode(
79 self,
80 encoder: &mut fidl::encoding::Encoder<'_, D>,
81 offset: usize,
82 _depth: fidl::encoding::Depth,
83 ) -> fidl::Result<()> {
84 encoder.debug_check_bounds::<Self>(offset);
85 encoder.write_num(self.into_primitive(), offset);
86 Ok(())
87 }
88 }
89
90 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ErrorCode {
91 #[inline(always)]
92 fn new_empty() -> Self {
93 Self::Internal
94 }
95
96 #[inline]
97 unsafe fn decode(
98 &mut self,
99 decoder: &mut fidl::encoding::Decoder<'_, D>,
100 offset: usize,
101 _depth: fidl::encoding::Depth,
102 ) -> fidl::Result<()> {
103 decoder.debug_check_bounds::<Self>(offset);
104 let prim = decoder.read_num::<u32>(offset);
105
106 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
107 Ok(())
108 }
109 }
110}