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