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
100pub mod action_iterator_ordinals {
101 pub const GET_NEXT: u64 = 0x3a6cfa20518e766a;
102}
103
104pub mod actor_ordinals {
105 pub const GET_ACTIONS: u64 = 0x21b890f66d9d9cff;
106 pub const RUN: u64 = 0x28a8ff83256eef02;
107}
108
109mod internal {
110 use super::*;
111
112 impl fidl::encoding::ValueTypeMarker for ActionIteratorGetNextResponse {
113 type Borrowed<'a> = &'a Self;
114 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
115 value
116 }
117 }
118
119 unsafe impl fidl::encoding::TypeMarker for ActionIteratorGetNextResponse {
120 type Owned = Self;
121
122 #[inline(always)]
123 fn inline_align(_context: fidl::encoding::Context) -> usize {
124 8
125 }
126
127 #[inline(always)]
128 fn inline_size(_context: fidl::encoding::Context) -> usize {
129 16
130 }
131 }
132
133 unsafe impl<D: fidl::encoding::ResourceDialect>
134 fidl::encoding::Encode<ActionIteratorGetNextResponse, D>
135 for &ActionIteratorGetNextResponse
136 {
137 #[inline]
138 unsafe fn encode(
139 self,
140 encoder: &mut fidl::encoding::Encoder<'_, D>,
141 offset: usize,
142 _depth: fidl::encoding::Depth,
143 ) -> fidl::Result<()> {
144 encoder.debug_check_bounds::<ActionIteratorGetNextResponse>(offset);
145 fidl::encoding::Encode::<ActionIteratorGetNextResponse, D>::encode(
147 (
148 <fidl::encoding::UnboundedVector<Action> as fidl::encoding::ValueTypeMarker>::borrow(&self.actions),
149 ),
150 encoder, offset, _depth
151 )
152 }
153 }
154 unsafe impl<
155 D: fidl::encoding::ResourceDialect,
156 T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Action>, D>,
157 > fidl::encoding::Encode<ActionIteratorGetNextResponse, D> for (T0,)
158 {
159 #[inline]
160 unsafe fn encode(
161 self,
162 encoder: &mut fidl::encoding::Encoder<'_, D>,
163 offset: usize,
164 depth: fidl::encoding::Depth,
165 ) -> fidl::Result<()> {
166 encoder.debug_check_bounds::<ActionIteratorGetNextResponse>(offset);
167 self.0.encode(encoder, offset + 0, depth)?;
171 Ok(())
172 }
173 }
174
175 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
176 for ActionIteratorGetNextResponse
177 {
178 #[inline(always)]
179 fn new_empty() -> Self {
180 Self { actions: fidl::new_empty!(fidl::encoding::UnboundedVector<Action>, D) }
181 }
182
183 #[inline]
184 unsafe fn decode(
185 &mut self,
186 decoder: &mut fidl::encoding::Decoder<'_, D>,
187 offset: usize,
188 _depth: fidl::encoding::Depth,
189 ) -> fidl::Result<()> {
190 decoder.debug_check_bounds::<Self>(offset);
191 fidl::decode!(
193 fidl::encoding::UnboundedVector<Action>,
194 D,
195 &mut self.actions,
196 decoder,
197 offset + 0,
198 _depth
199 )?;
200 Ok(())
201 }
202 }
203
204 impl fidl::encoding::ValueTypeMarker for ActorRunRequest {
205 type Borrowed<'a> = &'a Self;
206 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
207 value
208 }
209 }
210
211 unsafe impl fidl::encoding::TypeMarker for ActorRunRequest {
212 type Owned = Self;
213
214 #[inline(always)]
215 fn inline_align(_context: fidl::encoding::Context) -> usize {
216 8
217 }
218
219 #[inline(always)]
220 fn inline_size(_context: fidl::encoding::Context) -> usize {
221 24
222 }
223 }
224
225 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ActorRunRequest, D>
226 for &ActorRunRequest
227 {
228 #[inline]
229 unsafe fn encode(
230 self,
231 encoder: &mut fidl::encoding::Encoder<'_, D>,
232 offset: usize,
233 _depth: fidl::encoding::Depth,
234 ) -> fidl::Result<()> {
235 encoder.debug_check_bounds::<ActorRunRequest>(offset);
236 fidl::encoding::Encode::<ActorRunRequest, D>::encode(
238 (
239 <fidl::encoding::BoundedString<512> as fidl::encoding::ValueTypeMarker>::borrow(
240 &self.action_name,
241 ),
242 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.seed),
243 ),
244 encoder,
245 offset,
246 _depth,
247 )
248 }
249 }
250 unsafe impl<
251 D: fidl::encoding::ResourceDialect,
252 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<512>, D>,
253 T1: fidl::encoding::Encode<u64, D>,
254 > fidl::encoding::Encode<ActorRunRequest, D> for (T0, T1)
255 {
256 #[inline]
257 unsafe fn encode(
258 self,
259 encoder: &mut fidl::encoding::Encoder<'_, D>,
260 offset: usize,
261 depth: fidl::encoding::Depth,
262 ) -> fidl::Result<()> {
263 encoder.debug_check_bounds::<ActorRunRequest>(offset);
264 self.0.encode(encoder, offset + 0, depth)?;
268 self.1.encode(encoder, offset + 16, depth)?;
269 Ok(())
270 }
271 }
272
273 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ActorRunRequest {
274 #[inline(always)]
275 fn new_empty() -> Self {
276 Self {
277 action_name: fidl::new_empty!(fidl::encoding::BoundedString<512>, D),
278 seed: fidl::new_empty!(u64, D),
279 }
280 }
281
282 #[inline]
283 unsafe fn decode(
284 &mut self,
285 decoder: &mut fidl::encoding::Decoder<'_, D>,
286 offset: usize,
287 _depth: fidl::encoding::Depth,
288 ) -> fidl::Result<()> {
289 decoder.debug_check_bounds::<Self>(offset);
290 fidl::decode!(
292 fidl::encoding::BoundedString<512>,
293 D,
294 &mut self.action_name,
295 decoder,
296 offset + 0,
297 _depth
298 )?;
299 fidl::decode!(u64, D, &mut self.seed, decoder, offset + 16, _depth)?;
300 Ok(())
301 }
302 }
303
304 impl fidl::encoding::ValueTypeMarker for ActorRunResponse {
305 type Borrowed<'a> = &'a Self;
306 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
307 value
308 }
309 }
310
311 unsafe impl fidl::encoding::TypeMarker for ActorRunResponse {
312 type Owned = Self;
313
314 #[inline(always)]
315 fn inline_align(_context: fidl::encoding::Context) -> usize {
316 8
317 }
318
319 #[inline(always)]
320 fn inline_size(_context: fidl::encoding::Context) -> usize {
321 16
322 }
323 }
324
325 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ActorRunResponse, D>
326 for &ActorRunResponse
327 {
328 #[inline]
329 unsafe fn encode(
330 self,
331 encoder: &mut fidl::encoding::Encoder<'_, D>,
332 offset: usize,
333 _depth: fidl::encoding::Depth,
334 ) -> fidl::Result<()> {
335 encoder.debug_check_bounds::<ActorRunResponse>(offset);
336 fidl::encoding::Encode::<ActorRunResponse, D>::encode(
338 (
339 <fidl::encoding::OptionalUnion<Error> as fidl::encoding::ValueTypeMarker>::borrow(&self.error),
340 ),
341 encoder, offset, _depth
342 )
343 }
344 }
345 unsafe impl<
346 D: fidl::encoding::ResourceDialect,
347 T0: fidl::encoding::Encode<fidl::encoding::OptionalUnion<Error>, D>,
348 > fidl::encoding::Encode<ActorRunResponse, D> for (T0,)
349 {
350 #[inline]
351 unsafe fn encode(
352 self,
353 encoder: &mut fidl::encoding::Encoder<'_, D>,
354 offset: usize,
355 depth: fidl::encoding::Depth,
356 ) -> fidl::Result<()> {
357 encoder.debug_check_bounds::<ActorRunResponse>(offset);
358 self.0.encode(encoder, offset + 0, depth)?;
362 Ok(())
363 }
364 }
365
366 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ActorRunResponse {
367 #[inline(always)]
368 fn new_empty() -> Self {
369 Self { error: fidl::new_empty!(fidl::encoding::OptionalUnion<Error>, D) }
370 }
371
372 #[inline]
373 unsafe fn decode(
374 &mut self,
375 decoder: &mut fidl::encoding::Decoder<'_, D>,
376 offset: usize,
377 _depth: fidl::encoding::Depth,
378 ) -> fidl::Result<()> {
379 decoder.debug_check_bounds::<Self>(offset);
380 fidl::decode!(
382 fidl::encoding::OptionalUnion<Error>,
383 D,
384 &mut self.error,
385 decoder,
386 offset + 0,
387 _depth
388 )?;
389 Ok(())
390 }
391 }
392
393 impl Action {
394 #[inline(always)]
395 fn max_ordinal_present(&self) -> u64 {
396 if let Some(_) = self.name {
397 return 1;
398 }
399 0
400 }
401 }
402
403 impl fidl::encoding::ValueTypeMarker for Action {
404 type Borrowed<'a> = &'a Self;
405 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
406 value
407 }
408 }
409
410 unsafe impl fidl::encoding::TypeMarker for Action {
411 type Owned = Self;
412
413 #[inline(always)]
414 fn inline_align(_context: fidl::encoding::Context) -> usize {
415 8
416 }
417
418 #[inline(always)]
419 fn inline_size(_context: fidl::encoding::Context) -> usize {
420 16
421 }
422 }
423
424 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Action, D> for &Action {
425 unsafe fn encode(
426 self,
427 encoder: &mut fidl::encoding::Encoder<'_, D>,
428 offset: usize,
429 mut depth: fidl::encoding::Depth,
430 ) -> fidl::Result<()> {
431 encoder.debug_check_bounds::<Action>(offset);
432 let max_ordinal: u64 = self.max_ordinal_present();
434 encoder.write_num(max_ordinal, offset);
435 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
436 if max_ordinal == 0 {
438 return Ok(());
439 }
440 depth.increment()?;
441 let envelope_size = 8;
442 let bytes_len = max_ordinal as usize * envelope_size;
443 #[allow(unused_variables)]
444 let offset = encoder.out_of_line_offset(bytes_len);
445 let mut _prev_end_offset: usize = 0;
446 if 1 > max_ordinal {
447 return Ok(());
448 }
449
450 let cur_offset: usize = (1 - 1) * envelope_size;
453
454 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
456
457 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<512>, D>(
462 self.name.as_ref().map(
463 <fidl::encoding::BoundedString<512> as fidl::encoding::ValueTypeMarker>::borrow,
464 ),
465 encoder,
466 offset + cur_offset,
467 depth,
468 )?;
469
470 _prev_end_offset = cur_offset + envelope_size;
471
472 Ok(())
473 }
474 }
475
476 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Action {
477 #[inline(always)]
478 fn new_empty() -> Self {
479 Self::default()
480 }
481
482 unsafe fn decode(
483 &mut self,
484 decoder: &mut fidl::encoding::Decoder<'_, D>,
485 offset: usize,
486 mut depth: fidl::encoding::Depth,
487 ) -> fidl::Result<()> {
488 decoder.debug_check_bounds::<Self>(offset);
489 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
490 None => return Err(fidl::Error::NotNullable),
491 Some(len) => len,
492 };
493 if len == 0 {
495 return Ok(());
496 };
497 depth.increment()?;
498 let envelope_size = 8;
499 let bytes_len = len * envelope_size;
500 let offset = decoder.out_of_line_offset(bytes_len)?;
501 let mut _next_ordinal_to_read = 0;
503 let mut next_offset = offset;
504 let end_offset = offset + bytes_len;
505 _next_ordinal_to_read += 1;
506 if next_offset >= end_offset {
507 return Ok(());
508 }
509
510 while _next_ordinal_to_read < 1 {
512 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
513 _next_ordinal_to_read += 1;
514 next_offset += envelope_size;
515 }
516
517 let next_out_of_line = decoder.next_out_of_line();
518 let handles_before = decoder.remaining_handles();
519 if let Some((inlined, num_bytes, num_handles)) =
520 fidl::encoding::decode_envelope_header(decoder, next_offset)?
521 {
522 let member_inline_size =
523 <fidl::encoding::BoundedString<512> as fidl::encoding::TypeMarker>::inline_size(
524 decoder.context,
525 );
526 if inlined != (member_inline_size <= 4) {
527 return Err(fidl::Error::InvalidInlineBitInEnvelope);
528 }
529 let inner_offset;
530 let mut inner_depth = depth.clone();
531 if inlined {
532 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
533 inner_offset = next_offset;
534 } else {
535 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
536 inner_depth.increment()?;
537 }
538 let val_ref = self
539 .name
540 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<512>, D));
541 fidl::decode!(
542 fidl::encoding::BoundedString<512>,
543 D,
544 val_ref,
545 decoder,
546 inner_offset,
547 inner_depth
548 )?;
549 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
550 {
551 return Err(fidl::Error::InvalidNumBytesInEnvelope);
552 }
553 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
554 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
555 }
556 }
557
558 next_offset += envelope_size;
559
560 while next_offset < end_offset {
562 _next_ordinal_to_read += 1;
563 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
564 next_offset += envelope_size;
565 }
566
567 Ok(())
568 }
569 }
570
571 impl fidl::encoding::ValueTypeMarker for Error {
572 type Borrowed<'a> = &'a Self;
573 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
574 value
575 }
576 }
577
578 unsafe impl fidl::encoding::TypeMarker for Error {
579 type Owned = Self;
580
581 #[inline(always)]
582 fn inline_align(_context: fidl::encoding::Context) -> usize {
583 8
584 }
585
586 #[inline(always)]
587 fn inline_size(_context: fidl::encoding::Context) -> usize {
588 16
589 }
590 }
591
592 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Error, D> for &Error {
593 #[inline]
594 unsafe fn encode(
595 self,
596 encoder: &mut fidl::encoding::Encoder<'_, D>,
597 offset: usize,
598 _depth: fidl::encoding::Depth,
599 ) -> fidl::Result<()> {
600 encoder.debug_check_bounds::<Error>(offset);
601 encoder.write_num::<u64>(self.ordinal(), offset);
602 match self {
603 Error::ErrorString(ref val) => fidl::encoding::encode_in_envelope::<
604 fidl::encoding::BoundedString<512>,
605 D,
606 >(
607 <fidl::encoding::BoundedString<512> as fidl::encoding::ValueTypeMarker>::borrow(
608 val,
609 ),
610 encoder,
611 offset + 8,
612 _depth,
613 ),
614 Error::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
615 }
616 }
617 }
618
619 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
620 #[inline(always)]
621 fn new_empty() -> Self {
622 Self::__SourceBreaking { unknown_ordinal: 0 }
623 }
624
625 #[inline]
626 unsafe fn decode(
627 &mut self,
628 decoder: &mut fidl::encoding::Decoder<'_, D>,
629 offset: usize,
630 mut depth: fidl::encoding::Depth,
631 ) -> fidl::Result<()> {
632 decoder.debug_check_bounds::<Self>(offset);
633 #[allow(unused_variables)]
634 let next_out_of_line = decoder.next_out_of_line();
635 let handles_before = decoder.remaining_handles();
636 let (ordinal, inlined, num_bytes, num_handles) =
637 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
638
639 let member_inline_size = match ordinal {
640 1 => {
641 <fidl::encoding::BoundedString<512> as fidl::encoding::TypeMarker>::inline_size(
642 decoder.context,
643 )
644 }
645 0 => return Err(fidl::Error::UnknownUnionTag),
646 _ => num_bytes as usize,
647 };
648
649 if inlined != (member_inline_size <= 4) {
650 return Err(fidl::Error::InvalidInlineBitInEnvelope);
651 }
652 let _inner_offset;
653 if inlined {
654 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
655 _inner_offset = offset + 8;
656 } else {
657 depth.increment()?;
658 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
659 }
660 match ordinal {
661 1 => {
662 #[allow(irrefutable_let_patterns)]
663 if let Error::ErrorString(_) = self {
664 } else {
666 *self = Error::ErrorString(fidl::new_empty!(
668 fidl::encoding::BoundedString<512>,
669 D
670 ));
671 }
672 #[allow(irrefutable_let_patterns)]
673 if let Error::ErrorString(ref mut val) = self {
674 fidl::decode!(
675 fidl::encoding::BoundedString<512>,
676 D,
677 val,
678 decoder,
679 _inner_offset,
680 depth
681 )?;
682 } else {
683 unreachable!()
684 }
685 }
686 #[allow(deprecated)]
687 ordinal => {
688 for _ in 0..num_handles {
689 decoder.drop_next_handle()?;
690 }
691 *self = Error::__SourceBreaking { unknown_ordinal: ordinal };
692 }
693 }
694 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
695 return Err(fidl::Error::InvalidNumBytesInEnvelope);
696 }
697 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
698 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
699 }
700 Ok(())
701 }
702 }
703}