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 pub supports_xattrs: bool,
85 pub supports_symlinks: bool,
87}
88
89impl fidl::Persistable for HarnessConfig {}
90
91#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
93pub struct Symlink {
94 pub name: String,
95 pub target: Vec<u8>,
96}
97
98impl fidl::Persistable for Symlink {}
99
100#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
101pub struct TestHarnessGetConfigResponse {
102 pub config: HarnessConfig,
103}
104
105impl fidl::Persistable for TestHarnessGetConfigResponse {}
106
107pub mod test_harness_ordinals {
108 pub const GET_CONFIG: u64 = 0x758882a165dbaa23;
109 pub const CREATE_DIRECTORY: u64 = 0x626b0ce412a0cb4c;
110 pub const OPEN_SERVICE_DIRECTORY: u64 = 0x42904fe08b12ef88;
111}
112
113mod internal {
114 use super::*;
115
116 impl fidl::encoding::ValueTypeMarker for ExecutableFile {
117 type Borrowed<'a> = &'a Self;
118 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
119 value
120 }
121 }
122
123 unsafe impl fidl::encoding::TypeMarker for ExecutableFile {
124 type Owned = Self;
125
126 #[inline(always)]
127 fn inline_align(_context: fidl::encoding::Context) -> usize {
128 8
129 }
130
131 #[inline(always)]
132 fn inline_size(_context: fidl::encoding::Context) -> usize {
133 16
134 }
135 }
136
137 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ExecutableFile, D>
138 for &ExecutableFile
139 {
140 #[inline]
141 unsafe fn encode(
142 self,
143 encoder: &mut fidl::encoding::Encoder<'_, D>,
144 offset: usize,
145 _depth: fidl::encoding::Depth,
146 ) -> fidl::Result<()> {
147 encoder.debug_check_bounds::<ExecutableFile>(offset);
148 fidl::encoding::Encode::<ExecutableFile, D>::encode(
150 (<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
151 &self.name,
152 ),),
153 encoder,
154 offset,
155 _depth,
156 )
157 }
158 }
159 unsafe impl<
160 D: fidl::encoding::ResourceDialect,
161 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
162 > fidl::encoding::Encode<ExecutableFile, D> for (T0,)
163 {
164 #[inline]
165 unsafe fn encode(
166 self,
167 encoder: &mut fidl::encoding::Encoder<'_, D>,
168 offset: usize,
169 depth: fidl::encoding::Depth,
170 ) -> fidl::Result<()> {
171 encoder.debug_check_bounds::<ExecutableFile>(offset);
172 self.0.encode(encoder, offset + 0, depth)?;
176 Ok(())
177 }
178 }
179
180 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExecutableFile {
181 #[inline(always)]
182 fn new_empty() -> Self {
183 Self { name: fidl::new_empty!(fidl::encoding::BoundedString<255>, D) }
184 }
185
186 #[inline]
187 unsafe fn decode(
188 &mut self,
189 decoder: &mut fidl::encoding::Decoder<'_, D>,
190 offset: usize,
191 _depth: fidl::encoding::Depth,
192 ) -> fidl::Result<()> {
193 decoder.debug_check_bounds::<Self>(offset);
194 fidl::decode!(
196 fidl::encoding::BoundedString<255>,
197 D,
198 &mut self.name,
199 decoder,
200 offset + 0,
201 _depth
202 )?;
203 Ok(())
204 }
205 }
206
207 impl fidl::encoding::ValueTypeMarker for File {
208 type Borrowed<'a> = &'a Self;
209 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
210 value
211 }
212 }
213
214 unsafe impl fidl::encoding::TypeMarker for File {
215 type Owned = Self;
216
217 #[inline(always)]
218 fn inline_align(_context: fidl::encoding::Context) -> usize {
219 8
220 }
221
222 #[inline(always)]
223 fn inline_size(_context: fidl::encoding::Context) -> usize {
224 32
225 }
226 }
227
228 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<File, D> for &File {
229 #[inline]
230 unsafe fn encode(
231 self,
232 encoder: &mut fidl::encoding::Encoder<'_, D>,
233 offset: usize,
234 _depth: fidl::encoding::Depth,
235 ) -> fidl::Result<()> {
236 encoder.debug_check_bounds::<File>(offset);
237 fidl::encoding::Encode::<File, D>::encode(
239 (
240 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
241 <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.contents),
242 ),
243 encoder, offset, _depth
244 )
245 }
246 }
247 unsafe impl<
248 D: fidl::encoding::ResourceDialect,
249 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
250 T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
251 > fidl::encoding::Encode<File, D> for (T0, T1)
252 {
253 #[inline]
254 unsafe fn encode(
255 self,
256 encoder: &mut fidl::encoding::Encoder<'_, D>,
257 offset: usize,
258 depth: fidl::encoding::Depth,
259 ) -> fidl::Result<()> {
260 encoder.debug_check_bounds::<File>(offset);
261 self.0.encode(encoder, offset + 0, depth)?;
265 self.1.encode(encoder, offset + 16, depth)?;
266 Ok(())
267 }
268 }
269
270 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for File {
271 #[inline(always)]
272 fn new_empty() -> Self {
273 Self {
274 name: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
275 contents: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
276 }
277 }
278
279 #[inline]
280 unsafe fn decode(
281 &mut self,
282 decoder: &mut fidl::encoding::Decoder<'_, D>,
283 offset: usize,
284 _depth: fidl::encoding::Depth,
285 ) -> fidl::Result<()> {
286 decoder.debug_check_bounds::<Self>(offset);
287 fidl::decode!(
289 fidl::encoding::BoundedString<255>,
290 D,
291 &mut self.name,
292 decoder,
293 offset + 0,
294 _depth
295 )?;
296 fidl::decode!(
297 fidl::encoding::UnboundedVector<u8>,
298 D,
299 &mut self.contents,
300 decoder,
301 offset + 16,
302 _depth
303 )?;
304 Ok(())
305 }
306 }
307
308 impl fidl::encoding::ValueTypeMarker for HarnessConfig {
309 type Borrowed<'a> = &'a Self;
310 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
311 value
312 }
313 }
314
315 unsafe impl fidl::encoding::TypeMarker for HarnessConfig {
316 type Owned = Self;
317
318 #[inline(always)]
319 fn inline_align(_context: fidl::encoding::Context) -> usize {
320 8
321 }
322
323 #[inline(always)]
324 fn inline_size(_context: fidl::encoding::Context) -> usize {
325 24
326 }
327 }
328
329 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HarnessConfig, D>
330 for &HarnessConfig
331 {
332 #[inline]
333 unsafe fn encode(
334 self,
335 encoder: &mut fidl::encoding::Encoder<'_, D>,
336 offset: usize,
337 _depth: fidl::encoding::Depth,
338 ) -> fidl::Result<()> {
339 encoder.debug_check_bounds::<HarnessConfig>(offset);
340 fidl::encoding::Encode::<HarnessConfig, D>::encode(
342 (
343 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_executable_file),
344 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_mutable_file),
345 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_get_backing_memory),
346 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_remote_dir),
347 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_get_token),
348 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_link_into),
349 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_append),
350 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_truncate),
351 <fidl_fuchsia_io_common::NodeAttributesQuery as fidl::encoding::ValueTypeMarker>::borrow(&self.supported_attributes),
352 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_modify_directory),
353 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_services),
354 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_unnamed_temporary_file),
355 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_xattrs),
356 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_symlinks),
357 ),
358 encoder, offset, _depth
359 )
360 }
361 }
362 unsafe impl<
363 D: fidl::encoding::ResourceDialect,
364 T0: fidl::encoding::Encode<bool, D>,
365 T1: fidl::encoding::Encode<bool, D>,
366 T2: fidl::encoding::Encode<bool, D>,
367 T3: fidl::encoding::Encode<bool, D>,
368 T4: fidl::encoding::Encode<bool, D>,
369 T5: fidl::encoding::Encode<bool, D>,
370 T6: fidl::encoding::Encode<bool, D>,
371 T7: fidl::encoding::Encode<bool, D>,
372 T8: fidl::encoding::Encode<fidl_fuchsia_io_common::NodeAttributesQuery, D>,
373 T9: fidl::encoding::Encode<bool, D>,
374 T10: fidl::encoding::Encode<bool, D>,
375 T11: fidl::encoding::Encode<bool, D>,
376 T12: fidl::encoding::Encode<bool, D>,
377 T13: fidl::encoding::Encode<bool, D>,
378 > fidl::encoding::Encode<HarnessConfig, D>
379 for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)
380 {
381 #[inline]
382 unsafe fn encode(
383 self,
384 encoder: &mut fidl::encoding::Encoder<'_, D>,
385 offset: usize,
386 depth: fidl::encoding::Depth,
387 ) -> fidl::Result<()> {
388 encoder.debug_check_bounds::<HarnessConfig>(offset);
389 unsafe {
392 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
393 (ptr as *mut u64).write_unaligned(0);
394 }
395 self.0.encode(encoder, offset + 0, depth)?;
397 self.1.encode(encoder, offset + 1, depth)?;
398 self.2.encode(encoder, offset + 2, depth)?;
399 self.3.encode(encoder, offset + 3, depth)?;
400 self.4.encode(encoder, offset + 4, depth)?;
401 self.5.encode(encoder, offset + 5, depth)?;
402 self.6.encode(encoder, offset + 6, depth)?;
403 self.7.encode(encoder, offset + 7, depth)?;
404 self.8.encode(encoder, offset + 8, depth)?;
405 self.9.encode(encoder, offset + 16, depth)?;
406 self.10.encode(encoder, offset + 17, depth)?;
407 self.11.encode(encoder, offset + 18, depth)?;
408 self.12.encode(encoder, offset + 19, depth)?;
409 self.13.encode(encoder, offset + 20, depth)?;
410 Ok(())
411 }
412 }
413
414 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HarnessConfig {
415 #[inline(always)]
416 fn new_empty() -> Self {
417 Self {
418 supports_executable_file: fidl::new_empty!(bool, D),
419 supports_mutable_file: fidl::new_empty!(bool, D),
420 supports_get_backing_memory: fidl::new_empty!(bool, D),
421 supports_remote_dir: fidl::new_empty!(bool, D),
422 supports_get_token: fidl::new_empty!(bool, D),
423 supports_link_into: fidl::new_empty!(bool, D),
424 supports_append: fidl::new_empty!(bool, D),
425 supports_truncate: fidl::new_empty!(bool, D),
426 supported_attributes: fidl::new_empty!(
427 fidl_fuchsia_io_common::NodeAttributesQuery,
428 D
429 ),
430 supports_modify_directory: fidl::new_empty!(bool, D),
431 supports_services: fidl::new_empty!(bool, D),
432 supports_unnamed_temporary_file: fidl::new_empty!(bool, D),
433 supports_xattrs: fidl::new_empty!(bool, D),
434 supports_symlinks: fidl::new_empty!(bool, D),
435 }
436 }
437
438 #[inline]
439 unsafe fn decode(
440 &mut self,
441 decoder: &mut fidl::encoding::Decoder<'_, D>,
442 offset: usize,
443 _depth: fidl::encoding::Depth,
444 ) -> fidl::Result<()> {
445 decoder.debug_check_bounds::<Self>(offset);
446 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
448 let padval = unsafe { (ptr as *const u64).read_unaligned() };
449 let mask = 0xffffff0000000000u64;
450 let maskedval = padval & mask;
451 if maskedval != 0 {
452 return Err(fidl::Error::NonZeroPadding {
453 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
454 });
455 }
456 fidl::decode!(
457 bool,
458 D,
459 &mut self.supports_executable_file,
460 decoder,
461 offset + 0,
462 _depth
463 )?;
464 fidl::decode!(bool, D, &mut self.supports_mutable_file, decoder, offset + 1, _depth)?;
465 fidl::decode!(
466 bool,
467 D,
468 &mut self.supports_get_backing_memory,
469 decoder,
470 offset + 2,
471 _depth
472 )?;
473 fidl::decode!(bool, D, &mut self.supports_remote_dir, decoder, offset + 3, _depth)?;
474 fidl::decode!(bool, D, &mut self.supports_get_token, decoder, offset + 4, _depth)?;
475 fidl::decode!(bool, D, &mut self.supports_link_into, decoder, offset + 5, _depth)?;
476 fidl::decode!(bool, D, &mut self.supports_append, decoder, offset + 6, _depth)?;
477 fidl::decode!(bool, D, &mut self.supports_truncate, decoder, offset + 7, _depth)?;
478 fidl::decode!(
479 fidl_fuchsia_io_common::NodeAttributesQuery,
480 D,
481 &mut self.supported_attributes,
482 decoder,
483 offset + 8,
484 _depth
485 )?;
486 fidl::decode!(
487 bool,
488 D,
489 &mut self.supports_modify_directory,
490 decoder,
491 offset + 16,
492 _depth
493 )?;
494 fidl::decode!(bool, D, &mut self.supports_services, decoder, offset + 17, _depth)?;
495 fidl::decode!(
496 bool,
497 D,
498 &mut self.supports_unnamed_temporary_file,
499 decoder,
500 offset + 18,
501 _depth
502 )?;
503 fidl::decode!(bool, D, &mut self.supports_xattrs, decoder, offset + 19, _depth)?;
504 fidl::decode!(bool, D, &mut self.supports_symlinks, decoder, offset + 20, _depth)?;
505 Ok(())
506 }
507 }
508
509 impl fidl::encoding::ValueTypeMarker for Symlink {
510 type Borrowed<'a> = &'a Self;
511 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
512 value
513 }
514 }
515
516 unsafe impl fidl::encoding::TypeMarker for Symlink {
517 type Owned = Self;
518
519 #[inline(always)]
520 fn inline_align(_context: fidl::encoding::Context) -> usize {
521 8
522 }
523
524 #[inline(always)]
525 fn inline_size(_context: fidl::encoding::Context) -> usize {
526 32
527 }
528 }
529
530 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Symlink, D> for &Symlink {
531 #[inline]
532 unsafe fn encode(
533 self,
534 encoder: &mut fidl::encoding::Encoder<'_, D>,
535 offset: usize,
536 _depth: fidl::encoding::Depth,
537 ) -> fidl::Result<()> {
538 encoder.debug_check_bounds::<Symlink>(offset);
539 fidl::encoding::Encode::<Symlink, D>::encode(
541 (
542 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
543 &self.name,
544 ),
545 <fidl::encoding::Vector<u8, 4095> as fidl::encoding::ValueTypeMarker>::borrow(
546 &self.target,
547 ),
548 ),
549 encoder,
550 offset,
551 _depth,
552 )
553 }
554 }
555 unsafe impl<
556 D: fidl::encoding::ResourceDialect,
557 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
558 T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 4095>, D>,
559 > fidl::encoding::Encode<Symlink, D> for (T0, T1)
560 {
561 #[inline]
562 unsafe fn encode(
563 self,
564 encoder: &mut fidl::encoding::Encoder<'_, D>,
565 offset: usize,
566 depth: fidl::encoding::Depth,
567 ) -> fidl::Result<()> {
568 encoder.debug_check_bounds::<Symlink>(offset);
569 self.0.encode(encoder, offset + 0, depth)?;
573 self.1.encode(encoder, offset + 16, depth)?;
574 Ok(())
575 }
576 }
577
578 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Symlink {
579 #[inline(always)]
580 fn new_empty() -> Self {
581 Self {
582 name: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
583 target: fidl::new_empty!(fidl::encoding::Vector<u8, 4095>, D),
584 }
585 }
586
587 #[inline]
588 unsafe fn decode(
589 &mut self,
590 decoder: &mut fidl::encoding::Decoder<'_, D>,
591 offset: usize,
592 _depth: fidl::encoding::Depth,
593 ) -> fidl::Result<()> {
594 decoder.debug_check_bounds::<Self>(offset);
595 fidl::decode!(
597 fidl::encoding::BoundedString<255>,
598 D,
599 &mut self.name,
600 decoder,
601 offset + 0,
602 _depth
603 )?;
604 fidl::decode!(fidl::encoding::Vector<u8, 4095>, D, &mut self.target, decoder, offset + 16, _depth)?;
605 Ok(())
606 }
607 }
608
609 impl fidl::encoding::ValueTypeMarker for TestHarnessGetConfigResponse {
610 type Borrowed<'a> = &'a Self;
611 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
612 value
613 }
614 }
615
616 unsafe impl fidl::encoding::TypeMarker for TestHarnessGetConfigResponse {
617 type Owned = Self;
618
619 #[inline(always)]
620 fn inline_align(_context: fidl::encoding::Context) -> usize {
621 8
622 }
623
624 #[inline(always)]
625 fn inline_size(_context: fidl::encoding::Context) -> usize {
626 24
627 }
628 }
629
630 unsafe impl<D: fidl::encoding::ResourceDialect>
631 fidl::encoding::Encode<TestHarnessGetConfigResponse, D> for &TestHarnessGetConfigResponse
632 {
633 #[inline]
634 unsafe fn encode(
635 self,
636 encoder: &mut fidl::encoding::Encoder<'_, D>,
637 offset: usize,
638 _depth: fidl::encoding::Depth,
639 ) -> fidl::Result<()> {
640 encoder.debug_check_bounds::<TestHarnessGetConfigResponse>(offset);
641 fidl::encoding::Encode::<TestHarnessGetConfigResponse, D>::encode(
643 (<HarnessConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),),
644 encoder,
645 offset,
646 _depth,
647 )
648 }
649 }
650 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<HarnessConfig, D>>
651 fidl::encoding::Encode<TestHarnessGetConfigResponse, D> for (T0,)
652 {
653 #[inline]
654 unsafe fn encode(
655 self,
656 encoder: &mut fidl::encoding::Encoder<'_, D>,
657 offset: usize,
658 depth: fidl::encoding::Depth,
659 ) -> fidl::Result<()> {
660 encoder.debug_check_bounds::<TestHarnessGetConfigResponse>(offset);
661 self.0.encode(encoder, offset + 0, depth)?;
665 Ok(())
666 }
667 }
668
669 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
670 for TestHarnessGetConfigResponse
671 {
672 #[inline(always)]
673 fn new_empty() -> Self {
674 Self { config: fidl::new_empty!(HarnessConfig, D) }
675 }
676
677 #[inline]
678 unsafe fn decode(
679 &mut self,
680 decoder: &mut fidl::encoding::Decoder<'_, D>,
681 offset: usize,
682 _depth: fidl::encoding::Depth,
683 ) -> fidl::Result<()> {
684 decoder.debug_check_bounds::<Self>(offset);
685 fidl::decode!(HarnessConfig, D, &mut self.config, decoder, offset + 0, _depth)?;
687 Ok(())
688 }
689 }
690}