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
11pub type ActionName = String;
13
14#[derive(Clone, Debug, PartialEq)]
15pub struct ActionIteratorGetNextResponse {
16 pub actions: Vec<Action>,
17}
18
19impl fidl::Persistable for ActionIteratorGetNextResponse {}
20
21#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
22pub struct ActorRunRequest {
23 pub action_name: String,
24 pub seed: u64,
25}
26
27impl fidl::Persistable for ActorRunRequest {}
28
29#[derive(Clone, Debug, PartialEq)]
30pub struct ActorRunResponse {
31 pub error: Option<Box<Error>>,
32}
33
34impl fidl::Persistable for ActorRunResponse {}
35
36#[derive(Clone, Debug, Default, PartialEq)]
38pub struct Action {
39 pub name: Option<String>,
42 #[doc(hidden)]
43 pub __source_breaking: fidl::marker::SourceBreaking,
44}
45
46impl fidl::Persistable for Action {}
47
48#[derive(Clone, Debug)]
50pub enum Error {
51 ErrorString(String),
53 #[doc(hidden)]
54 __SourceBreaking { unknown_ordinal: u64 },
55}
56
57#[macro_export]
59macro_rules! ErrorUnknown {
60 () => {
61 _
62 };
63}
64
65impl PartialEq for Error {
67 fn eq(&self, other: &Self) -> bool {
68 match (self, other) {
69 (Self::ErrorString(x), Self::ErrorString(y)) => *x == *y,
70 _ => false,
71 }
72 }
73}
74
75impl Error {
76 #[inline]
77 pub fn ordinal(&self) -> u64 {
78 match *self {
79 Self::ErrorString(_) => 1,
80 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
81 }
82 }
83
84 #[inline]
85 pub fn unknown_variant_for_testing() -> Self {
86 Self::__SourceBreaking { unknown_ordinal: 0 }
87 }
88
89 #[inline]
90 pub fn is_unknown(&self) -> bool {
91 match self {
92 Self::__SourceBreaking { .. } => true,
93 _ => false,
94 }
95 }
96}
97
98impl fidl::Persistable for Error {}
99
100mod internal {
101 use super::*;
102
103 impl fidl::encoding::ValueTypeMarker for ActionIteratorGetNextResponse {
104 type Borrowed<'a> = &'a Self;
105 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
106 value
107 }
108 }
109
110 unsafe impl fidl::encoding::TypeMarker for ActionIteratorGetNextResponse {
111 type Owned = Self;
112
113 #[inline(always)]
114 fn inline_align(_context: fidl::encoding::Context) -> usize {
115 8
116 }
117
118 #[inline(always)]
119 fn inline_size(_context: fidl::encoding::Context) -> usize {
120 16
121 }
122 }
123
124 unsafe impl<D: fidl::encoding::ResourceDialect>
125 fidl::encoding::Encode<ActionIteratorGetNextResponse, D>
126 for &ActionIteratorGetNextResponse
127 {
128 #[inline]
129 unsafe fn encode(
130 self,
131 encoder: &mut fidl::encoding::Encoder<'_, D>,
132 offset: usize,
133 _depth: fidl::encoding::Depth,
134 ) -> fidl::Result<()> {
135 encoder.debug_check_bounds::<ActionIteratorGetNextResponse>(offset);
136 fidl::encoding::Encode::<ActionIteratorGetNextResponse, D>::encode(
138 (
139 <fidl::encoding::UnboundedVector<Action> as fidl::encoding::ValueTypeMarker>::borrow(&self.actions),
140 ),
141 encoder, offset, _depth
142 )
143 }
144 }
145 unsafe impl<
146 D: fidl::encoding::ResourceDialect,
147 T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Action>, D>,
148 > fidl::encoding::Encode<ActionIteratorGetNextResponse, D> for (T0,)
149 {
150 #[inline]
151 unsafe fn encode(
152 self,
153 encoder: &mut fidl::encoding::Encoder<'_, D>,
154 offset: usize,
155 depth: fidl::encoding::Depth,
156 ) -> fidl::Result<()> {
157 encoder.debug_check_bounds::<ActionIteratorGetNextResponse>(offset);
158 self.0.encode(encoder, offset + 0, depth)?;
162 Ok(())
163 }
164 }
165
166 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
167 for ActionIteratorGetNextResponse
168 {
169 #[inline(always)]
170 fn new_empty() -> Self {
171 Self { actions: fidl::new_empty!(fidl::encoding::UnboundedVector<Action>, D) }
172 }
173
174 #[inline]
175 unsafe fn decode(
176 &mut self,
177 decoder: &mut fidl::encoding::Decoder<'_, D>,
178 offset: usize,
179 _depth: fidl::encoding::Depth,
180 ) -> fidl::Result<()> {
181 decoder.debug_check_bounds::<Self>(offset);
182 fidl::decode!(
184 fidl::encoding::UnboundedVector<Action>,
185 D,
186 &mut self.actions,
187 decoder,
188 offset + 0,
189 _depth
190 )?;
191 Ok(())
192 }
193 }
194
195 impl fidl::encoding::ValueTypeMarker for ActorRunRequest {
196 type Borrowed<'a> = &'a Self;
197 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
198 value
199 }
200 }
201
202 unsafe impl fidl::encoding::TypeMarker for ActorRunRequest {
203 type Owned = Self;
204
205 #[inline(always)]
206 fn inline_align(_context: fidl::encoding::Context) -> usize {
207 8
208 }
209
210 #[inline(always)]
211 fn inline_size(_context: fidl::encoding::Context) -> usize {
212 24
213 }
214 }
215
216 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ActorRunRequest, D>
217 for &ActorRunRequest
218 {
219 #[inline]
220 unsafe fn encode(
221 self,
222 encoder: &mut fidl::encoding::Encoder<'_, D>,
223 offset: usize,
224 _depth: fidl::encoding::Depth,
225 ) -> fidl::Result<()> {
226 encoder.debug_check_bounds::<ActorRunRequest>(offset);
227 fidl::encoding::Encode::<ActorRunRequest, D>::encode(
229 (
230 <fidl::encoding::BoundedString<512> as fidl::encoding::ValueTypeMarker>::borrow(
231 &self.action_name,
232 ),
233 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.seed),
234 ),
235 encoder,
236 offset,
237 _depth,
238 )
239 }
240 }
241 unsafe impl<
242 D: fidl::encoding::ResourceDialect,
243 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<512>, D>,
244 T1: fidl::encoding::Encode<u64, D>,
245 > fidl::encoding::Encode<ActorRunRequest, D> for (T0, T1)
246 {
247 #[inline]
248 unsafe fn encode(
249 self,
250 encoder: &mut fidl::encoding::Encoder<'_, D>,
251 offset: usize,
252 depth: fidl::encoding::Depth,
253 ) -> fidl::Result<()> {
254 encoder.debug_check_bounds::<ActorRunRequest>(offset);
255 self.0.encode(encoder, offset + 0, depth)?;
259 self.1.encode(encoder, offset + 16, depth)?;
260 Ok(())
261 }
262 }
263
264 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ActorRunRequest {
265 #[inline(always)]
266 fn new_empty() -> Self {
267 Self {
268 action_name: fidl::new_empty!(fidl::encoding::BoundedString<512>, D),
269 seed: fidl::new_empty!(u64, D),
270 }
271 }
272
273 #[inline]
274 unsafe fn decode(
275 &mut self,
276 decoder: &mut fidl::encoding::Decoder<'_, D>,
277 offset: usize,
278 _depth: fidl::encoding::Depth,
279 ) -> fidl::Result<()> {
280 decoder.debug_check_bounds::<Self>(offset);
281 fidl::decode!(
283 fidl::encoding::BoundedString<512>,
284 D,
285 &mut self.action_name,
286 decoder,
287 offset + 0,
288 _depth
289 )?;
290 fidl::decode!(u64, D, &mut self.seed, decoder, offset + 16, _depth)?;
291 Ok(())
292 }
293 }
294
295 impl fidl::encoding::ValueTypeMarker for ActorRunResponse {
296 type Borrowed<'a> = &'a Self;
297 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
298 value
299 }
300 }
301
302 unsafe impl fidl::encoding::TypeMarker for ActorRunResponse {
303 type Owned = Self;
304
305 #[inline(always)]
306 fn inline_align(_context: fidl::encoding::Context) -> usize {
307 8
308 }
309
310 #[inline(always)]
311 fn inline_size(_context: fidl::encoding::Context) -> usize {
312 16
313 }
314 }
315
316 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ActorRunResponse, D>
317 for &ActorRunResponse
318 {
319 #[inline]
320 unsafe fn encode(
321 self,
322 encoder: &mut fidl::encoding::Encoder<'_, D>,
323 offset: usize,
324 _depth: fidl::encoding::Depth,
325 ) -> fidl::Result<()> {
326 encoder.debug_check_bounds::<ActorRunResponse>(offset);
327 fidl::encoding::Encode::<ActorRunResponse, D>::encode(
329 (
330 <fidl::encoding::OptionalUnion<Error> as fidl::encoding::ValueTypeMarker>::borrow(&self.error),
331 ),
332 encoder, offset, _depth
333 )
334 }
335 }
336 unsafe impl<
337 D: fidl::encoding::ResourceDialect,
338 T0: fidl::encoding::Encode<fidl::encoding::OptionalUnion<Error>, D>,
339 > fidl::encoding::Encode<ActorRunResponse, D> for (T0,)
340 {
341 #[inline]
342 unsafe fn encode(
343 self,
344 encoder: &mut fidl::encoding::Encoder<'_, D>,
345 offset: usize,
346 depth: fidl::encoding::Depth,
347 ) -> fidl::Result<()> {
348 encoder.debug_check_bounds::<ActorRunResponse>(offset);
349 self.0.encode(encoder, offset + 0, depth)?;
353 Ok(())
354 }
355 }
356
357 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ActorRunResponse {
358 #[inline(always)]
359 fn new_empty() -> Self {
360 Self { error: fidl::new_empty!(fidl::encoding::OptionalUnion<Error>, D) }
361 }
362
363 #[inline]
364 unsafe fn decode(
365 &mut self,
366 decoder: &mut fidl::encoding::Decoder<'_, D>,
367 offset: usize,
368 _depth: fidl::encoding::Depth,
369 ) -> fidl::Result<()> {
370 decoder.debug_check_bounds::<Self>(offset);
371 fidl::decode!(
373 fidl::encoding::OptionalUnion<Error>,
374 D,
375 &mut self.error,
376 decoder,
377 offset + 0,
378 _depth
379 )?;
380 Ok(())
381 }
382 }
383
384 impl Action {
385 #[inline(always)]
386 fn max_ordinal_present(&self) -> u64 {
387 if let Some(_) = self.name {
388 return 1;
389 }
390 0
391 }
392 }
393
394 impl fidl::encoding::ValueTypeMarker for Action {
395 type Borrowed<'a> = &'a Self;
396 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
397 value
398 }
399 }
400
401 unsafe impl fidl::encoding::TypeMarker for Action {
402 type Owned = Self;
403
404 #[inline(always)]
405 fn inline_align(_context: fidl::encoding::Context) -> usize {
406 8
407 }
408
409 #[inline(always)]
410 fn inline_size(_context: fidl::encoding::Context) -> usize {
411 16
412 }
413 }
414
415 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Action, D> for &Action {
416 unsafe fn encode(
417 self,
418 encoder: &mut fidl::encoding::Encoder<'_, D>,
419 offset: usize,
420 mut depth: fidl::encoding::Depth,
421 ) -> fidl::Result<()> {
422 encoder.debug_check_bounds::<Action>(offset);
423 let max_ordinal: u64 = self.max_ordinal_present();
425 encoder.write_num(max_ordinal, offset);
426 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
427 if max_ordinal == 0 {
429 return Ok(());
430 }
431 depth.increment()?;
432 let envelope_size = 8;
433 let bytes_len = max_ordinal as usize * envelope_size;
434 #[allow(unused_variables)]
435 let offset = encoder.out_of_line_offset(bytes_len);
436 let mut _prev_end_offset: usize = 0;
437 if 1 > max_ordinal {
438 return Ok(());
439 }
440
441 let cur_offset: usize = (1 - 1) * envelope_size;
444
445 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
447
448 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<512>, D>(
453 self.name.as_ref().map(
454 <fidl::encoding::BoundedString<512> as fidl::encoding::ValueTypeMarker>::borrow,
455 ),
456 encoder,
457 offset + cur_offset,
458 depth,
459 )?;
460
461 _prev_end_offset = cur_offset + envelope_size;
462
463 Ok(())
464 }
465 }
466
467 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Action {
468 #[inline(always)]
469 fn new_empty() -> Self {
470 Self::default()
471 }
472
473 unsafe fn decode(
474 &mut self,
475 decoder: &mut fidl::encoding::Decoder<'_, D>,
476 offset: usize,
477 mut depth: fidl::encoding::Depth,
478 ) -> fidl::Result<()> {
479 decoder.debug_check_bounds::<Self>(offset);
480 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
481 None => return Err(fidl::Error::NotNullable),
482 Some(len) => len,
483 };
484 if len == 0 {
486 return Ok(());
487 };
488 depth.increment()?;
489 let envelope_size = 8;
490 let bytes_len = len * envelope_size;
491 let offset = decoder.out_of_line_offset(bytes_len)?;
492 let mut _next_ordinal_to_read = 0;
494 let mut next_offset = offset;
495 let end_offset = offset + bytes_len;
496 _next_ordinal_to_read += 1;
497 if next_offset >= end_offset {
498 return Ok(());
499 }
500
501 while _next_ordinal_to_read < 1 {
503 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
504 _next_ordinal_to_read += 1;
505 next_offset += envelope_size;
506 }
507
508 let next_out_of_line = decoder.next_out_of_line();
509 let handles_before = decoder.remaining_handles();
510 if let Some((inlined, num_bytes, num_handles)) =
511 fidl::encoding::decode_envelope_header(decoder, next_offset)?
512 {
513 let member_inline_size =
514 <fidl::encoding::BoundedString<512> as fidl::encoding::TypeMarker>::inline_size(
515 decoder.context,
516 );
517 if inlined != (member_inline_size <= 4) {
518 return Err(fidl::Error::InvalidInlineBitInEnvelope);
519 }
520 let inner_offset;
521 let mut inner_depth = depth.clone();
522 if inlined {
523 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
524 inner_offset = next_offset;
525 } else {
526 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
527 inner_depth.increment()?;
528 }
529 let val_ref = self
530 .name
531 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<512>, D));
532 fidl::decode!(
533 fidl::encoding::BoundedString<512>,
534 D,
535 val_ref,
536 decoder,
537 inner_offset,
538 inner_depth
539 )?;
540 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
541 {
542 return Err(fidl::Error::InvalidNumBytesInEnvelope);
543 }
544 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
545 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
546 }
547 }
548
549 next_offset += envelope_size;
550
551 while next_offset < end_offset {
553 _next_ordinal_to_read += 1;
554 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
555 next_offset += envelope_size;
556 }
557
558 Ok(())
559 }
560 }
561
562 impl fidl::encoding::ValueTypeMarker for Error {
563 type Borrowed<'a> = &'a Self;
564 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
565 value
566 }
567 }
568
569 unsafe impl fidl::encoding::TypeMarker for Error {
570 type Owned = Self;
571
572 #[inline(always)]
573 fn inline_align(_context: fidl::encoding::Context) -> usize {
574 8
575 }
576
577 #[inline(always)]
578 fn inline_size(_context: fidl::encoding::Context) -> usize {
579 16
580 }
581 }
582
583 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Error, D> for &Error {
584 #[inline]
585 unsafe fn encode(
586 self,
587 encoder: &mut fidl::encoding::Encoder<'_, D>,
588 offset: usize,
589 _depth: fidl::encoding::Depth,
590 ) -> fidl::Result<()> {
591 encoder.debug_check_bounds::<Error>(offset);
592 encoder.write_num::<u64>(self.ordinal(), offset);
593 match self {
594 Error::ErrorString(ref val) => fidl::encoding::encode_in_envelope::<
595 fidl::encoding::BoundedString<512>,
596 D,
597 >(
598 <fidl::encoding::BoundedString<512> as fidl::encoding::ValueTypeMarker>::borrow(
599 val,
600 ),
601 encoder,
602 offset + 8,
603 _depth,
604 ),
605 Error::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
606 }
607 }
608 }
609
610 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
611 #[inline(always)]
612 fn new_empty() -> Self {
613 Self::__SourceBreaking { unknown_ordinal: 0 }
614 }
615
616 #[inline]
617 unsafe fn decode(
618 &mut self,
619 decoder: &mut fidl::encoding::Decoder<'_, D>,
620 offset: usize,
621 mut depth: fidl::encoding::Depth,
622 ) -> fidl::Result<()> {
623 decoder.debug_check_bounds::<Self>(offset);
624 #[allow(unused_variables)]
625 let next_out_of_line = decoder.next_out_of_line();
626 let handles_before = decoder.remaining_handles();
627 let (ordinal, inlined, num_bytes, num_handles) =
628 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
629
630 let member_inline_size = match ordinal {
631 1 => {
632 <fidl::encoding::BoundedString<512> as fidl::encoding::TypeMarker>::inline_size(
633 decoder.context,
634 )
635 }
636 0 => return Err(fidl::Error::UnknownUnionTag),
637 _ => num_bytes as usize,
638 };
639
640 if inlined != (member_inline_size <= 4) {
641 return Err(fidl::Error::InvalidInlineBitInEnvelope);
642 }
643 let _inner_offset;
644 if inlined {
645 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
646 _inner_offset = offset + 8;
647 } else {
648 depth.increment()?;
649 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
650 }
651 match ordinal {
652 1 => {
653 #[allow(irrefutable_let_patterns)]
654 if let Error::ErrorString(_) = self {
655 } else {
657 *self = Error::ErrorString(fidl::new_empty!(
659 fidl::encoding::BoundedString<512>,
660 D
661 ));
662 }
663 #[allow(irrefutable_let_patterns)]
664 if let Error::ErrorString(ref mut val) = self {
665 fidl::decode!(
666 fidl::encoding::BoundedString<512>,
667 D,
668 val,
669 decoder,
670 _inner_offset,
671 depth
672 )?;
673 } else {
674 unreachable!()
675 }
676 }
677 #[allow(deprecated)]
678 ordinal => {
679 for _ in 0..num_handles {
680 decoder.drop_next_handle()?;
681 }
682 *self = Error::__SourceBreaking { unknown_ordinal: ordinal };
683 }
684 }
685 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
686 return Err(fidl::Error::InvalidNumBytesInEnvelope);
687 }
688 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
689 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
690 }
691 Ok(())
692 }
693 }
694}