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