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)]
17pub struct ExecutableFile {
18 pub name: String,
19}
20
21impl fidl::Persistable for ExecutableFile {}
22
23#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct File {
27 pub name: String,
28 pub contents: Vec<u8>,
29}
30
31impl fidl::Persistable for File {}
32
33#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
57pub struct HarnessConfig {
58 pub supports_executable_file: bool,
60 pub supports_mutable_file: bool,
62 pub supports_get_backing_memory: bool,
64 pub supports_remote_dir: bool,
66 pub supports_get_token: bool,
68 pub supports_link_into: bool,
70 pub supports_append: bool,
72 pub supports_truncate: bool,
74 pub supported_attributes: fidl_fuchsia_io::NodeAttributesQuery,
77 pub supports_modify_directory: bool,
79 pub supports_services: bool,
81 pub supports_unnamed_temporary_file: bool,
83}
84
85impl fidl::Persistable for HarnessConfig {}
86
87#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
88pub struct TestHarnessGetConfigResponse {
89 pub config: HarnessConfig,
90}
91
92impl fidl::Persistable for TestHarnessGetConfigResponse {}
93
94mod internal {
95 use super::*;
96
97 impl fidl::encoding::ValueTypeMarker for ExecutableFile {
98 type Borrowed<'a> = &'a Self;
99 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
100 value
101 }
102 }
103
104 unsafe impl fidl::encoding::TypeMarker for ExecutableFile {
105 type Owned = Self;
106
107 #[inline(always)]
108 fn inline_align(_context: fidl::encoding::Context) -> usize {
109 8
110 }
111
112 #[inline(always)]
113 fn inline_size(_context: fidl::encoding::Context) -> usize {
114 16
115 }
116 }
117
118 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ExecutableFile, D>
119 for &ExecutableFile
120 {
121 #[inline]
122 unsafe fn encode(
123 self,
124 encoder: &mut fidl::encoding::Encoder<'_, D>,
125 offset: usize,
126 _depth: fidl::encoding::Depth,
127 ) -> fidl::Result<()> {
128 encoder.debug_check_bounds::<ExecutableFile>(offset);
129 fidl::encoding::Encode::<ExecutableFile, D>::encode(
131 (<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
132 &self.name,
133 ),),
134 encoder,
135 offset,
136 _depth,
137 )
138 }
139 }
140 unsafe impl<
141 D: fidl::encoding::ResourceDialect,
142 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
143 > fidl::encoding::Encode<ExecutableFile, D> for (T0,)
144 {
145 #[inline]
146 unsafe fn encode(
147 self,
148 encoder: &mut fidl::encoding::Encoder<'_, D>,
149 offset: usize,
150 depth: fidl::encoding::Depth,
151 ) -> fidl::Result<()> {
152 encoder.debug_check_bounds::<ExecutableFile>(offset);
153 self.0.encode(encoder, offset + 0, depth)?;
157 Ok(())
158 }
159 }
160
161 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExecutableFile {
162 #[inline(always)]
163 fn new_empty() -> Self {
164 Self { name: fidl::new_empty!(fidl::encoding::BoundedString<255>, D) }
165 }
166
167 #[inline]
168 unsafe fn decode(
169 &mut self,
170 decoder: &mut fidl::encoding::Decoder<'_, D>,
171 offset: usize,
172 _depth: fidl::encoding::Depth,
173 ) -> fidl::Result<()> {
174 decoder.debug_check_bounds::<Self>(offset);
175 fidl::decode!(
177 fidl::encoding::BoundedString<255>,
178 D,
179 &mut self.name,
180 decoder,
181 offset + 0,
182 _depth
183 )?;
184 Ok(())
185 }
186 }
187
188 impl fidl::encoding::ValueTypeMarker for File {
189 type Borrowed<'a> = &'a Self;
190 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
191 value
192 }
193 }
194
195 unsafe impl fidl::encoding::TypeMarker for File {
196 type Owned = Self;
197
198 #[inline(always)]
199 fn inline_align(_context: fidl::encoding::Context) -> usize {
200 8
201 }
202
203 #[inline(always)]
204 fn inline_size(_context: fidl::encoding::Context) -> usize {
205 32
206 }
207 }
208
209 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<File, D> for &File {
210 #[inline]
211 unsafe fn encode(
212 self,
213 encoder: &mut fidl::encoding::Encoder<'_, D>,
214 offset: usize,
215 _depth: fidl::encoding::Depth,
216 ) -> fidl::Result<()> {
217 encoder.debug_check_bounds::<File>(offset);
218 fidl::encoding::Encode::<File, D>::encode(
220 (
221 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
222 <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.contents),
223 ),
224 encoder, offset, _depth
225 )
226 }
227 }
228 unsafe impl<
229 D: fidl::encoding::ResourceDialect,
230 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
231 T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
232 > fidl::encoding::Encode<File, D> for (T0, T1)
233 {
234 #[inline]
235 unsafe fn encode(
236 self,
237 encoder: &mut fidl::encoding::Encoder<'_, D>,
238 offset: usize,
239 depth: fidl::encoding::Depth,
240 ) -> fidl::Result<()> {
241 encoder.debug_check_bounds::<File>(offset);
242 self.0.encode(encoder, offset + 0, depth)?;
246 self.1.encode(encoder, offset + 16, depth)?;
247 Ok(())
248 }
249 }
250
251 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for File {
252 #[inline(always)]
253 fn new_empty() -> Self {
254 Self {
255 name: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
256 contents: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
257 }
258 }
259
260 #[inline]
261 unsafe fn decode(
262 &mut self,
263 decoder: &mut fidl::encoding::Decoder<'_, D>,
264 offset: usize,
265 _depth: fidl::encoding::Depth,
266 ) -> fidl::Result<()> {
267 decoder.debug_check_bounds::<Self>(offset);
268 fidl::decode!(
270 fidl::encoding::BoundedString<255>,
271 D,
272 &mut self.name,
273 decoder,
274 offset + 0,
275 _depth
276 )?;
277 fidl::decode!(
278 fidl::encoding::UnboundedVector<u8>,
279 D,
280 &mut self.contents,
281 decoder,
282 offset + 16,
283 _depth
284 )?;
285 Ok(())
286 }
287 }
288
289 impl fidl::encoding::ValueTypeMarker for HarnessConfig {
290 type Borrowed<'a> = &'a Self;
291 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
292 value
293 }
294 }
295
296 unsafe impl fidl::encoding::TypeMarker for HarnessConfig {
297 type Owned = Self;
298
299 #[inline(always)]
300 fn inline_align(_context: fidl::encoding::Context) -> usize {
301 8
302 }
303
304 #[inline(always)]
305 fn inline_size(_context: fidl::encoding::Context) -> usize {
306 24
307 }
308 }
309
310 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HarnessConfig, D>
311 for &HarnessConfig
312 {
313 #[inline]
314 unsafe fn encode(
315 self,
316 encoder: &mut fidl::encoding::Encoder<'_, D>,
317 offset: usize,
318 _depth: fidl::encoding::Depth,
319 ) -> fidl::Result<()> {
320 encoder.debug_check_bounds::<HarnessConfig>(offset);
321 fidl::encoding::Encode::<HarnessConfig, D>::encode(
323 (
324 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_executable_file),
325 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_mutable_file),
326 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_get_backing_memory),
327 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_remote_dir),
328 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_get_token),
329 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_link_into),
330 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_append),
331 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_truncate),
332 <fidl_fuchsia_io::NodeAttributesQuery as fidl::encoding::ValueTypeMarker>::borrow(&self.supported_attributes),
333 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_modify_directory),
334 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_services),
335 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_unnamed_temporary_file),
336 ),
337 encoder, offset, _depth
338 )
339 }
340 }
341 unsafe impl<
342 D: fidl::encoding::ResourceDialect,
343 T0: fidl::encoding::Encode<bool, D>,
344 T1: fidl::encoding::Encode<bool, D>,
345 T2: fidl::encoding::Encode<bool, D>,
346 T3: fidl::encoding::Encode<bool, D>,
347 T4: fidl::encoding::Encode<bool, D>,
348 T5: fidl::encoding::Encode<bool, D>,
349 T6: fidl::encoding::Encode<bool, D>,
350 T7: fidl::encoding::Encode<bool, D>,
351 T8: fidl::encoding::Encode<fidl_fuchsia_io::NodeAttributesQuery, D>,
352 T9: fidl::encoding::Encode<bool, D>,
353 T10: fidl::encoding::Encode<bool, D>,
354 T11: fidl::encoding::Encode<bool, D>,
355 > fidl::encoding::Encode<HarnessConfig, D>
356 for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
357 {
358 #[inline]
359 unsafe fn encode(
360 self,
361 encoder: &mut fidl::encoding::Encoder<'_, D>,
362 offset: usize,
363 depth: fidl::encoding::Depth,
364 ) -> fidl::Result<()> {
365 encoder.debug_check_bounds::<HarnessConfig>(offset);
366 unsafe {
369 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
370 (ptr as *mut u64).write_unaligned(0);
371 }
372 self.0.encode(encoder, offset + 0, depth)?;
374 self.1.encode(encoder, offset + 1, depth)?;
375 self.2.encode(encoder, offset + 2, depth)?;
376 self.3.encode(encoder, offset + 3, depth)?;
377 self.4.encode(encoder, offset + 4, depth)?;
378 self.5.encode(encoder, offset + 5, depth)?;
379 self.6.encode(encoder, offset + 6, depth)?;
380 self.7.encode(encoder, offset + 7, depth)?;
381 self.8.encode(encoder, offset + 8, depth)?;
382 self.9.encode(encoder, offset + 16, depth)?;
383 self.10.encode(encoder, offset + 17, depth)?;
384 self.11.encode(encoder, offset + 18, depth)?;
385 Ok(())
386 }
387 }
388
389 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HarnessConfig {
390 #[inline(always)]
391 fn new_empty() -> Self {
392 Self {
393 supports_executable_file: fidl::new_empty!(bool, D),
394 supports_mutable_file: fidl::new_empty!(bool, D),
395 supports_get_backing_memory: fidl::new_empty!(bool, D),
396 supports_remote_dir: fidl::new_empty!(bool, D),
397 supports_get_token: fidl::new_empty!(bool, D),
398 supports_link_into: fidl::new_empty!(bool, D),
399 supports_append: fidl::new_empty!(bool, D),
400 supports_truncate: fidl::new_empty!(bool, D),
401 supported_attributes: fidl::new_empty!(fidl_fuchsia_io::NodeAttributesQuery, D),
402 supports_modify_directory: fidl::new_empty!(bool, D),
403 supports_services: fidl::new_empty!(bool, D),
404 supports_unnamed_temporary_file: fidl::new_empty!(bool, D),
405 }
406 }
407
408 #[inline]
409 unsafe fn decode(
410 &mut self,
411 decoder: &mut fidl::encoding::Decoder<'_, D>,
412 offset: usize,
413 _depth: fidl::encoding::Depth,
414 ) -> fidl::Result<()> {
415 decoder.debug_check_bounds::<Self>(offset);
416 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
418 let padval = unsafe { (ptr as *const u64).read_unaligned() };
419 let mask = 0xffffffffff000000u64;
420 let maskedval = padval & mask;
421 if maskedval != 0 {
422 return Err(fidl::Error::NonZeroPadding {
423 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
424 });
425 }
426 fidl::decode!(
427 bool,
428 D,
429 &mut self.supports_executable_file,
430 decoder,
431 offset + 0,
432 _depth
433 )?;
434 fidl::decode!(bool, D, &mut self.supports_mutable_file, decoder, offset + 1, _depth)?;
435 fidl::decode!(
436 bool,
437 D,
438 &mut self.supports_get_backing_memory,
439 decoder,
440 offset + 2,
441 _depth
442 )?;
443 fidl::decode!(bool, D, &mut self.supports_remote_dir, decoder, offset + 3, _depth)?;
444 fidl::decode!(bool, D, &mut self.supports_get_token, decoder, offset + 4, _depth)?;
445 fidl::decode!(bool, D, &mut self.supports_link_into, decoder, offset + 5, _depth)?;
446 fidl::decode!(bool, D, &mut self.supports_append, decoder, offset + 6, _depth)?;
447 fidl::decode!(bool, D, &mut self.supports_truncate, decoder, offset + 7, _depth)?;
448 fidl::decode!(
449 fidl_fuchsia_io::NodeAttributesQuery,
450 D,
451 &mut self.supported_attributes,
452 decoder,
453 offset + 8,
454 _depth
455 )?;
456 fidl::decode!(
457 bool,
458 D,
459 &mut self.supports_modify_directory,
460 decoder,
461 offset + 16,
462 _depth
463 )?;
464 fidl::decode!(bool, D, &mut self.supports_services, decoder, offset + 17, _depth)?;
465 fidl::decode!(
466 bool,
467 D,
468 &mut self.supports_unnamed_temporary_file,
469 decoder,
470 offset + 18,
471 _depth
472 )?;
473 Ok(())
474 }
475 }
476
477 impl fidl::encoding::ValueTypeMarker for TestHarnessGetConfigResponse {
478 type Borrowed<'a> = &'a Self;
479 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
480 value
481 }
482 }
483
484 unsafe impl fidl::encoding::TypeMarker for TestHarnessGetConfigResponse {
485 type Owned = Self;
486
487 #[inline(always)]
488 fn inline_align(_context: fidl::encoding::Context) -> usize {
489 8
490 }
491
492 #[inline(always)]
493 fn inline_size(_context: fidl::encoding::Context) -> usize {
494 24
495 }
496 }
497
498 unsafe impl<D: fidl::encoding::ResourceDialect>
499 fidl::encoding::Encode<TestHarnessGetConfigResponse, D> for &TestHarnessGetConfigResponse
500 {
501 #[inline]
502 unsafe fn encode(
503 self,
504 encoder: &mut fidl::encoding::Encoder<'_, D>,
505 offset: usize,
506 _depth: fidl::encoding::Depth,
507 ) -> fidl::Result<()> {
508 encoder.debug_check_bounds::<TestHarnessGetConfigResponse>(offset);
509 fidl::encoding::Encode::<TestHarnessGetConfigResponse, D>::encode(
511 (<HarnessConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),),
512 encoder,
513 offset,
514 _depth,
515 )
516 }
517 }
518 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<HarnessConfig, D>>
519 fidl::encoding::Encode<TestHarnessGetConfigResponse, D> for (T0,)
520 {
521 #[inline]
522 unsafe fn encode(
523 self,
524 encoder: &mut fidl::encoding::Encoder<'_, D>,
525 offset: usize,
526 depth: fidl::encoding::Depth,
527 ) -> fidl::Result<()> {
528 encoder.debug_check_bounds::<TestHarnessGetConfigResponse>(offset);
529 self.0.encode(encoder, offset + 0, depth)?;
533 Ok(())
534 }
535 }
536
537 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
538 for TestHarnessGetConfigResponse
539 {
540 #[inline(always)]
541 fn new_empty() -> Self {
542 Self { config: fidl::new_empty!(HarnessConfig, D) }
543 }
544
545 #[inline]
546 unsafe fn decode(
547 &mut self,
548 decoder: &mut fidl::encoding::Decoder<'_, D>,
549 offset: usize,
550 _depth: fidl::encoding::Depth,
551 ) -> fidl::Result<()> {
552 decoder.debug_check_bounds::<Self>(offset);
553 fidl::decode!(HarnessConfig, D, &mut self.config, decoder, offset + 0, _depth)?;
555 Ok(())
556 }
557 }
558}