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__common::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__common::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__common::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!(
402 fidl_fuchsia_io__common::NodeAttributesQuery,
403 D
404 ),
405 supports_modify_directory: fidl::new_empty!(bool, D),
406 supports_services: fidl::new_empty!(bool, D),
407 supports_unnamed_temporary_file: fidl::new_empty!(bool, D),
408 }
409 }
410
411 #[inline]
412 unsafe fn decode(
413 &mut self,
414 decoder: &mut fidl::encoding::Decoder<'_, D>,
415 offset: usize,
416 _depth: fidl::encoding::Depth,
417 ) -> fidl::Result<()> {
418 decoder.debug_check_bounds::<Self>(offset);
419 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
421 let padval = unsafe { (ptr as *const u64).read_unaligned() };
422 let mask = 0xffffffffff000000u64;
423 let maskedval = padval & mask;
424 if maskedval != 0 {
425 return Err(fidl::Error::NonZeroPadding {
426 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
427 });
428 }
429 fidl::decode!(
430 bool,
431 D,
432 &mut self.supports_executable_file,
433 decoder,
434 offset + 0,
435 _depth
436 )?;
437 fidl::decode!(bool, D, &mut self.supports_mutable_file, decoder, offset + 1, _depth)?;
438 fidl::decode!(
439 bool,
440 D,
441 &mut self.supports_get_backing_memory,
442 decoder,
443 offset + 2,
444 _depth
445 )?;
446 fidl::decode!(bool, D, &mut self.supports_remote_dir, decoder, offset + 3, _depth)?;
447 fidl::decode!(bool, D, &mut self.supports_get_token, decoder, offset + 4, _depth)?;
448 fidl::decode!(bool, D, &mut self.supports_link_into, decoder, offset + 5, _depth)?;
449 fidl::decode!(bool, D, &mut self.supports_append, decoder, offset + 6, _depth)?;
450 fidl::decode!(bool, D, &mut self.supports_truncate, decoder, offset + 7, _depth)?;
451 fidl::decode!(
452 fidl_fuchsia_io__common::NodeAttributesQuery,
453 D,
454 &mut self.supported_attributes,
455 decoder,
456 offset + 8,
457 _depth
458 )?;
459 fidl::decode!(
460 bool,
461 D,
462 &mut self.supports_modify_directory,
463 decoder,
464 offset + 16,
465 _depth
466 )?;
467 fidl::decode!(bool, D, &mut self.supports_services, decoder, offset + 17, _depth)?;
468 fidl::decode!(
469 bool,
470 D,
471 &mut self.supports_unnamed_temporary_file,
472 decoder,
473 offset + 18,
474 _depth
475 )?;
476 Ok(())
477 }
478 }
479
480 impl fidl::encoding::ValueTypeMarker for TestHarnessGetConfigResponse {
481 type Borrowed<'a> = &'a Self;
482 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
483 value
484 }
485 }
486
487 unsafe impl fidl::encoding::TypeMarker for TestHarnessGetConfigResponse {
488 type Owned = Self;
489
490 #[inline(always)]
491 fn inline_align(_context: fidl::encoding::Context) -> usize {
492 8
493 }
494
495 #[inline(always)]
496 fn inline_size(_context: fidl::encoding::Context) -> usize {
497 24
498 }
499 }
500
501 unsafe impl<D: fidl::encoding::ResourceDialect>
502 fidl::encoding::Encode<TestHarnessGetConfigResponse, D> for &TestHarnessGetConfigResponse
503 {
504 #[inline]
505 unsafe fn encode(
506 self,
507 encoder: &mut fidl::encoding::Encoder<'_, D>,
508 offset: usize,
509 _depth: fidl::encoding::Depth,
510 ) -> fidl::Result<()> {
511 encoder.debug_check_bounds::<TestHarnessGetConfigResponse>(offset);
512 fidl::encoding::Encode::<TestHarnessGetConfigResponse, D>::encode(
514 (<HarnessConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),),
515 encoder,
516 offset,
517 _depth,
518 )
519 }
520 }
521 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<HarnessConfig, D>>
522 fidl::encoding::Encode<TestHarnessGetConfigResponse, D> for (T0,)
523 {
524 #[inline]
525 unsafe fn encode(
526 self,
527 encoder: &mut fidl::encoding::Encoder<'_, D>,
528 offset: usize,
529 depth: fidl::encoding::Depth,
530 ) -> fidl::Result<()> {
531 encoder.debug_check_bounds::<TestHarnessGetConfigResponse>(offset);
532 self.0.encode(encoder, offset + 0, depth)?;
536 Ok(())
537 }
538 }
539
540 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
541 for TestHarnessGetConfigResponse
542 {
543 #[inline(always)]
544 fn new_empty() -> Self {
545 Self { config: fidl::new_empty!(HarnessConfig, D) }
546 }
547
548 #[inline]
549 unsafe fn decode(
550 &mut self,
551 decoder: &mut fidl::encoding::Decoder<'_, D>,
552 offset: usize,
553 _depth: fidl::encoding::Depth,
554 ) -> fidl::Result<()> {
555 decoder.debug_check_bounds::<Self>(offset);
556 fidl::decode!(HarnessConfig, D, &mut self.config, decoder, offset + 0, _depth)?;
558 Ok(())
559 }
560 }
561}