fidl_test_powerelementrunner__common/
fidl_test_powerelementrunner__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)]
12pub enum StartPowerElementError {
13 Internal,
14 InvalidClientEnd,
15 #[doc(hidden)]
16 __SourceBreaking {
17 unknown_ordinal: u32,
18 },
19}
20
21#[macro_export]
23macro_rules! StartPowerElementErrorUnknown {
24 () => {
25 _
26 };
27}
28
29impl StartPowerElementError {
30 #[inline]
31 pub fn from_primitive(prim: u32) -> Option<Self> {
32 match prim {
33 1 => Some(Self::Internal),
34 2 => Some(Self::InvalidClientEnd),
35 _ => None,
36 }
37 }
38
39 #[inline]
40 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
41 match prim {
42 1 => Self::Internal,
43 2 => Self::InvalidClientEnd,
44 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
45 }
46 }
47
48 #[inline]
49 pub fn unknown() -> Self {
50 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
51 }
52
53 #[inline]
54 pub const fn into_primitive(self) -> u32 {
55 match self {
56 Self::Internal => 1,
57 Self::InvalidClientEnd => 2,
58 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
59 }
60 }
61
62 #[inline]
63 pub fn is_unknown(&self) -> bool {
64 match self {
65 Self::__SourceBreaking { unknown_ordinal: _ } => true,
66 _ => false,
67 }
68 }
69}
70
71pub mod control_ordinals {
72 pub const START: u64 = 0x3e14e93b8fd19ea6;
73}
74
75mod internal {
76 use super::*;
77 unsafe impl fidl::encoding::TypeMarker for StartPowerElementError {
78 type Owned = Self;
79
80 #[inline(always)]
81 fn inline_align(_context: fidl::encoding::Context) -> usize {
82 std::mem::align_of::<u32>()
83 }
84
85 #[inline(always)]
86 fn inline_size(_context: fidl::encoding::Context) -> usize {
87 std::mem::size_of::<u32>()
88 }
89
90 #[inline(always)]
91 fn encode_is_copy() -> bool {
92 false
93 }
94
95 #[inline(always)]
96 fn decode_is_copy() -> bool {
97 false
98 }
99 }
100
101 impl fidl::encoding::ValueTypeMarker for StartPowerElementError {
102 type Borrowed<'a> = Self;
103 #[inline(always)]
104 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
105 *value
106 }
107 }
108
109 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
110 for StartPowerElementError
111 {
112 #[inline]
113 unsafe fn encode(
114 self,
115 encoder: &mut fidl::encoding::Encoder<'_, D>,
116 offset: usize,
117 _depth: fidl::encoding::Depth,
118 ) -> fidl::Result<()> {
119 encoder.debug_check_bounds::<Self>(offset);
120 encoder.write_num(self.into_primitive(), offset);
121 Ok(())
122 }
123 }
124
125 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
126 for StartPowerElementError
127 {
128 #[inline(always)]
129 fn new_empty() -> Self {
130 Self::unknown()
131 }
132
133 #[inline]
134 unsafe fn decode(
135 &mut self,
136 decoder: &mut fidl::encoding::Decoder<'_, D>,
137 offset: usize,
138 _depth: fidl::encoding::Depth,
139 ) -> fidl::Result<()> {
140 decoder.debug_check_bounds::<Self>(offset);
141 let prim = decoder.read_num::<u32>(offset);
142
143 *self = Self::from_primitive_allow_unknown(prim);
144 Ok(())
145 }
146 }
147}