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