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
11#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12pub struct BasicSuccessSchema {
13 pub my_flag: bool,
14 pub my_uint8: u8,
15 pub my_uint16: u16,
16 pub my_uint32: u32,
17 pub my_uint64: u64,
18 pub my_int8: i8,
19 pub my_int16: i16,
20 pub my_int32: i32,
21 pub my_int64: i64,
22 pub my_string: String,
23 pub my_vector_of_flag: Vec<bool>,
24 pub my_vector_of_uint8: Vec<u8>,
25 pub my_vector_of_uint16: Vec<u16>,
26 pub my_vector_of_uint32: Vec<u32>,
27 pub my_vector_of_uint64: Vec<u64>,
28 pub my_vector_of_int8: Vec<i8>,
29 pub my_vector_of_int16: Vec<i16>,
30 pub my_vector_of_int32: Vec<i32>,
31 pub my_vector_of_int64: Vec<i64>,
32 pub my_vector_of_string: Vec<String>,
33}
34
35impl fidl::Persistable for BasicSuccessSchema {}
36
37mod internal {
38 use super::*;
39
40 impl fidl::encoding::ValueTypeMarker for BasicSuccessSchema {
41 type Borrowed<'a> = &'a Self;
42 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
43 value
44 }
45 }
46
47 unsafe impl fidl::encoding::TypeMarker for BasicSuccessSchema {
48 type Owned = Self;
49
50 #[inline(always)]
51 fn inline_align(_context: fidl::encoding::Context) -> usize {
52 8
53 }
54
55 #[inline(always)]
56 fn inline_size(_context: fidl::encoding::Context) -> usize {
57 208
58 }
59 }
60
61 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BasicSuccessSchema, D>
62 for &BasicSuccessSchema
63 {
64 #[inline]
65 unsafe fn encode(
66 self,
67 encoder: &mut fidl::encoding::Encoder<'_, D>,
68 offset: usize,
69 _depth: fidl::encoding::Depth,
70 ) -> fidl::Result<()> {
71 encoder.debug_check_bounds::<BasicSuccessSchema>(offset);
72 fidl::encoding::Encode::<BasicSuccessSchema, D>::encode(
74 (
75 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.my_flag),
76 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_uint8),
77 <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_uint16),
78 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_uint32),
79 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_uint64),
80 <i8 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_int8),
81 <i16 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_int16),
82 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_int32),
83 <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.my_int64),
84 <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_string),
85 <fidl::encoding::Vector<bool, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_flag),
86 <fidl::encoding::Vector<u8, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_uint8),
87 <fidl::encoding::Vector<u16, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_uint16),
88 <fidl::encoding::Vector<u32, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_uint32),
89 <fidl::encoding::Vector<u64, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_uint64),
90 <fidl::encoding::Vector<i8, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_int8),
91 <fidl::encoding::Vector<i16, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_int16),
92 <fidl::encoding::Vector<i32, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_int32),
93 <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_int64),
94 <fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.my_vector_of_string),
95 ),
96 encoder, offset, _depth
97 )
98 }
99 }
100 unsafe impl<
101 D: fidl::encoding::ResourceDialect,
102 T0: fidl::encoding::Encode<bool, D>,
103 T1: fidl::encoding::Encode<u8, D>,
104 T2: fidl::encoding::Encode<u16, D>,
105 T3: fidl::encoding::Encode<u32, D>,
106 T4: fidl::encoding::Encode<u64, D>,
107 T5: fidl::encoding::Encode<i8, D>,
108 T6: fidl::encoding::Encode<i16, D>,
109 T7: fidl::encoding::Encode<i32, D>,
110 T8: fidl::encoding::Encode<i64, D>,
111 T9: fidl::encoding::Encode<fidl::encoding::BoundedString<100>, D>,
112 T10: fidl::encoding::Encode<fidl::encoding::Vector<bool, 100>, D>,
113 T11: fidl::encoding::Encode<fidl::encoding::Vector<u8, 100>, D>,
114 T12: fidl::encoding::Encode<fidl::encoding::Vector<u16, 100>, D>,
115 T13: fidl::encoding::Encode<fidl::encoding::Vector<u32, 100>, D>,
116 T14: fidl::encoding::Encode<fidl::encoding::Vector<u64, 100>, D>,
117 T15: fidl::encoding::Encode<fidl::encoding::Vector<i8, 100>, D>,
118 T16: fidl::encoding::Encode<fidl::encoding::Vector<i16, 100>, D>,
119 T17: fidl::encoding::Encode<fidl::encoding::Vector<i32, 100>, D>,
120 T18: fidl::encoding::Encode<fidl::encoding::Vector<i64, 100>, D>,
121 T19: fidl::encoding::Encode<
122 fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100>,
123 D,
124 >,
125 > fidl::encoding::Encode<BasicSuccessSchema, D>
126 for (
127 T0,
128 T1,
129 T2,
130 T3,
131 T4,
132 T5,
133 T6,
134 T7,
135 T8,
136 T9,
137 T10,
138 T11,
139 T12,
140 T13,
141 T14,
142 T15,
143 T16,
144 T17,
145 T18,
146 T19,
147 )
148 {
149 #[inline]
150 unsafe fn encode(
151 self,
152 encoder: &mut fidl::encoding::Encoder<'_, D>,
153 offset: usize,
154 depth: fidl::encoding::Depth,
155 ) -> fidl::Result<()> {
156 encoder.debug_check_bounds::<BasicSuccessSchema>(offset);
157 unsafe {
160 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
161 (ptr as *mut u64).write_unaligned(0);
162 }
163 self.0.encode(encoder, offset + 0, depth)?;
165 self.1.encode(encoder, offset + 1, depth)?;
166 self.2.encode(encoder, offset + 2, depth)?;
167 self.3.encode(encoder, offset + 4, depth)?;
168 self.4.encode(encoder, offset + 8, depth)?;
169 self.5.encode(encoder, offset + 16, depth)?;
170 self.6.encode(encoder, offset + 18, depth)?;
171 self.7.encode(encoder, offset + 20, depth)?;
172 self.8.encode(encoder, offset + 24, depth)?;
173 self.9.encode(encoder, offset + 32, depth)?;
174 self.10.encode(encoder, offset + 48, depth)?;
175 self.11.encode(encoder, offset + 64, depth)?;
176 self.12.encode(encoder, offset + 80, depth)?;
177 self.13.encode(encoder, offset + 96, depth)?;
178 self.14.encode(encoder, offset + 112, depth)?;
179 self.15.encode(encoder, offset + 128, depth)?;
180 self.16.encode(encoder, offset + 144, depth)?;
181 self.17.encode(encoder, offset + 160, depth)?;
182 self.18.encode(encoder, offset + 176, depth)?;
183 self.19.encode(encoder, offset + 192, depth)?;
184 Ok(())
185 }
186 }
187
188 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BasicSuccessSchema {
189 #[inline(always)]
190 fn new_empty() -> Self {
191 Self {
192 my_flag: fidl::new_empty!(bool, D),
193 my_uint8: fidl::new_empty!(u8, D),
194 my_uint16: fidl::new_empty!(u16, D),
195 my_uint32: fidl::new_empty!(u32, D),
196 my_uint64: fidl::new_empty!(u64, D),
197 my_int8: fidl::new_empty!(i8, D),
198 my_int16: fidl::new_empty!(i16, D),
199 my_int32: fidl::new_empty!(i32, D),
200 my_int64: fidl::new_empty!(i64, D),
201 my_string: fidl::new_empty!(fidl::encoding::BoundedString<100>, D),
202 my_vector_of_flag: fidl::new_empty!(fidl::encoding::Vector<bool, 100>, D),
203 my_vector_of_uint8: fidl::new_empty!(fidl::encoding::Vector<u8, 100>, D),
204 my_vector_of_uint16: fidl::new_empty!(fidl::encoding::Vector<u16, 100>, D),
205 my_vector_of_uint32: fidl::new_empty!(fidl::encoding::Vector<u32, 100>, D),
206 my_vector_of_uint64: fidl::new_empty!(fidl::encoding::Vector<u64, 100>, D),
207 my_vector_of_int8: fidl::new_empty!(fidl::encoding::Vector<i8, 100>, D),
208 my_vector_of_int16: fidl::new_empty!(fidl::encoding::Vector<i16, 100>, D),
209 my_vector_of_int32: fidl::new_empty!(fidl::encoding::Vector<i32, 100>, D),
210 my_vector_of_int64: fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D),
211 my_vector_of_string: fidl::new_empty!(
212 fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100>,
213 D
214 ),
215 }
216 }
217
218 #[inline]
219 unsafe fn decode(
220 &mut self,
221 decoder: &mut fidl::encoding::Decoder<'_, D>,
222 offset: usize,
223 _depth: fidl::encoding::Depth,
224 ) -> fidl::Result<()> {
225 decoder.debug_check_bounds::<Self>(offset);
226 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
228 let padval = unsafe { (ptr as *const u64).read_unaligned() };
229 let mask = 0xff00u64;
230 let maskedval = padval & mask;
231 if maskedval != 0 {
232 return Err(fidl::Error::NonZeroPadding {
233 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
234 });
235 }
236 fidl::decode!(bool, D, &mut self.my_flag, decoder, offset + 0, _depth)?;
237 fidl::decode!(u8, D, &mut self.my_uint8, decoder, offset + 1, _depth)?;
238 fidl::decode!(u16, D, &mut self.my_uint16, decoder, offset + 2, _depth)?;
239 fidl::decode!(u32, D, &mut self.my_uint32, decoder, offset + 4, _depth)?;
240 fidl::decode!(u64, D, &mut self.my_uint64, decoder, offset + 8, _depth)?;
241 fidl::decode!(i8, D, &mut self.my_int8, decoder, offset + 16, _depth)?;
242 fidl::decode!(i16, D, &mut self.my_int16, decoder, offset + 18, _depth)?;
243 fidl::decode!(i32, D, &mut self.my_int32, decoder, offset + 20, _depth)?;
244 fidl::decode!(i64, D, &mut self.my_int64, decoder, offset + 24, _depth)?;
245 fidl::decode!(
246 fidl::encoding::BoundedString<100>,
247 D,
248 &mut self.my_string,
249 decoder,
250 offset + 32,
251 _depth
252 )?;
253 fidl::decode!(fidl::encoding::Vector<bool, 100>, D, &mut self.my_vector_of_flag, decoder, offset + 48, _depth)?;
254 fidl::decode!(fidl::encoding::Vector<u8, 100>, D, &mut self.my_vector_of_uint8, decoder, offset + 64, _depth)?;
255 fidl::decode!(fidl::encoding::Vector<u16, 100>, D, &mut self.my_vector_of_uint16, decoder, offset + 80, _depth)?;
256 fidl::decode!(fidl::encoding::Vector<u32, 100>, D, &mut self.my_vector_of_uint32, decoder, offset + 96, _depth)?;
257 fidl::decode!(fidl::encoding::Vector<u64, 100>, D, &mut self.my_vector_of_uint64, decoder, offset + 112, _depth)?;
258 fidl::decode!(fidl::encoding::Vector<i8, 100>, D, &mut self.my_vector_of_int8, decoder, offset + 128, _depth)?;
259 fidl::decode!(fidl::encoding::Vector<i16, 100>, D, &mut self.my_vector_of_int16, decoder, offset + 144, _depth)?;
260 fidl::decode!(fidl::encoding::Vector<i32, 100>, D, &mut self.my_vector_of_int32, decoder, offset + 160, _depth)?;
261 fidl::decode!(fidl::encoding::Vector<i64, 100>, D, &mut self.my_vector_of_int64, decoder, offset + 176, _depth)?;
262 fidl::decode!(
263 fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100>,
264 D,
265 &mut self.my_vector_of_string,
266 decoder,
267 offset + 192,
268 _depth
269 )?;
270 Ok(())
271 }
272 }
273}