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