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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
13pub enum LaunchError {
14 InvalidArgs,
16 NotFound,
18 DestroyComponentFailed,
20 CreateComponentFailed,
22 #[doc(hidden)]
23 __SourceBreaking { unknown_ordinal: u32 },
24}
25
26#[macro_export]
28macro_rules! LaunchErrorUnknown {
29 () => {
30 _
31 };
32}
33
34impl LaunchError {
35 #[inline]
36 pub fn from_primitive(prim: u32) -> Option<Self> {
37 match prim {
38 1 => Some(Self::InvalidArgs),
39 2 => Some(Self::NotFound),
40 3 => Some(Self::DestroyComponentFailed),
41 4 => Some(Self::CreateComponentFailed),
42 _ => None,
43 }
44 }
45
46 #[inline]
47 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
48 match prim {
49 1 => Self::InvalidArgs,
50 2 => Self::NotFound,
51 3 => Self::DestroyComponentFailed,
52 4 => Self::CreateComponentFailed,
53 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
54 }
55 }
56
57 #[inline]
58 pub fn unknown() -> Self {
59 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
60 }
61
62 #[inline]
63 pub const fn into_primitive(self) -> u32 {
64 match self {
65 Self::InvalidArgs => 1,
66 Self::NotFound => 2,
67 Self::DestroyComponentFailed => 3,
68 Self::CreateComponentFailed => 4,
69 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
70 }
71 }
72
73 #[inline]
74 pub fn is_unknown(&self) -> bool {
75 match self {
76 Self::__SourceBreaking { unknown_ordinal: _ } => true,
77 _ => false,
78 }
79 }
80}
81
82#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
84pub enum LifecycleError {
85 NotFound,
87 AlreadyStarted,
89 ResolveComponentFailed,
91 CreateComponentFailed,
93 DestroyComponentFailed,
95 #[doc(hidden)]
96 __SourceBreaking { unknown_ordinal: u32 },
97}
98
99#[macro_export]
101macro_rules! LifecycleErrorUnknown {
102 () => {
103 _
104 };
105}
106
107impl LifecycleError {
108 #[inline]
109 pub fn from_primitive(prim: u32) -> Option<Self> {
110 match prim {
111 1 => Some(Self::NotFound),
112 2 => Some(Self::AlreadyStarted),
113 3 => Some(Self::ResolveComponentFailed),
114 4 => Some(Self::CreateComponentFailed),
115 5 => Some(Self::DestroyComponentFailed),
116 _ => None,
117 }
118 }
119
120 #[inline]
121 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
122 match prim {
123 1 => Self::NotFound,
124 2 => Self::AlreadyStarted,
125 3 => Self::ResolveComponentFailed,
126 4 => Self::CreateComponentFailed,
127 5 => Self::DestroyComponentFailed,
128 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
129 }
130 }
131
132 #[inline]
133 pub fn unknown() -> Self {
134 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
135 }
136
137 #[inline]
138 pub const fn into_primitive(self) -> u32 {
139 match self {
140 Self::NotFound => 1,
141 Self::AlreadyStarted => 2,
142 Self::ResolveComponentFailed => 3,
143 Self::CreateComponentFailed => 4,
144 Self::DestroyComponentFailed => 5,
145 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
146 }
147 }
148
149 #[inline]
150 pub fn is_unknown(&self) -> bool {
151 match self {
152 Self::__SourceBreaking { unknown_ordinal: _ } => true,
153 _ => false,
154 }
155 }
156}
157
158#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
160pub enum RestartError {
161 NotRunning,
163 NotFound,
165 DestroyComponentFailed,
167 CreateComponentFailed,
169 #[doc(hidden)]
170 __SourceBreaking { unknown_ordinal: u32 },
171}
172
173#[macro_export]
175macro_rules! RestartErrorUnknown {
176 () => {
177 _
178 };
179}
180
181impl RestartError {
182 #[inline]
183 pub fn from_primitive(prim: u32) -> Option<Self> {
184 match prim {
185 1 => Some(Self::NotRunning),
186 2 => Some(Self::NotFound),
187 3 => Some(Self::DestroyComponentFailed),
188 4 => Some(Self::CreateComponentFailed),
189 _ => None,
190 }
191 }
192
193 #[inline]
194 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
195 match prim {
196 1 => Self::NotRunning,
197 2 => Self::NotFound,
198 3 => Self::DestroyComponentFailed,
199 4 => Self::CreateComponentFailed,
200 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
201 }
202 }
203
204 #[inline]
205 pub fn unknown() -> Self {
206 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
207 }
208
209 #[inline]
210 pub const fn into_primitive(self) -> u32 {
211 match self {
212 Self::NotRunning => 1,
213 Self::NotFound => 2,
214 Self::DestroyComponentFailed => 3,
215 Self::CreateComponentFailed => 4,
216 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
217 }
218 }
219
220 #[inline]
221 pub fn is_unknown(&self) -> bool {
222 match self {
223 Self::__SourceBreaking { unknown_ordinal: _ } => true,
224 _ => false,
225 }
226 }
227}
228
229#[derive(Clone, Debug, PartialEq)]
230pub struct LauncherLaunchRequest {
231 pub configuration: LaunchConfiguration,
232}
233
234impl fidl::Persistable for LauncherLaunchRequest {}
235
236#[derive(Clone, Debug, Default, PartialEq)]
238pub struct LaunchConfiguration {
239 pub session_url: Option<String>,
241 pub config_capabilities: Option<Vec<fidl_fuchsia_component_decl__common::Configuration>>,
251 #[doc(hidden)]
252 pub __source_breaking: fidl::marker::SourceBreaking,
253}
254
255impl fidl::Persistable for LaunchConfiguration {}
256
257#[derive(Clone, Debug, Default, PartialEq)]
258pub struct LifecycleStartRequest {
259 pub session_url: Option<String>,
263 #[doc(hidden)]
264 pub __source_breaking: fidl::marker::SourceBreaking,
265}
266
267impl fidl::Persistable for LifecycleStartRequest {}
268
269pub mod launcher_ordinals {
270 pub const LAUNCH: u64 = 0x7674a4287f8a385a;
271}
272
273pub mod lifecycle_ordinals {
274 pub const START: u64 = 0x2fda381d2cc41ce0;
275 pub const STOP: u64 = 0x453a9158431b4a2;
276 pub const RESTART: u64 = 0x31faeac257bf1abb;
277}
278
279pub mod restarter_ordinals {
280 pub const RESTART: u64 = 0x50cd09e53189e5ae;
281}
282
283mod internal {
284 use super::*;
285 unsafe impl fidl::encoding::TypeMarker for LaunchError {
286 type Owned = Self;
287
288 #[inline(always)]
289 fn inline_align(_context: fidl::encoding::Context) -> usize {
290 std::mem::align_of::<u32>()
291 }
292
293 #[inline(always)]
294 fn inline_size(_context: fidl::encoding::Context) -> usize {
295 std::mem::size_of::<u32>()
296 }
297
298 #[inline(always)]
299 fn encode_is_copy() -> bool {
300 false
301 }
302
303 #[inline(always)]
304 fn decode_is_copy() -> bool {
305 false
306 }
307 }
308
309 impl fidl::encoding::ValueTypeMarker for LaunchError {
310 type Borrowed<'a> = Self;
311 #[inline(always)]
312 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
313 *value
314 }
315 }
316
317 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for LaunchError {
318 #[inline]
319 unsafe fn encode(
320 self,
321 encoder: &mut fidl::encoding::Encoder<'_, D>,
322 offset: usize,
323 _depth: fidl::encoding::Depth,
324 ) -> fidl::Result<()> {
325 encoder.debug_check_bounds::<Self>(offset);
326 encoder.write_num(self.into_primitive(), offset);
327 Ok(())
328 }
329 }
330
331 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LaunchError {
332 #[inline(always)]
333 fn new_empty() -> Self {
334 Self::unknown()
335 }
336
337 #[inline]
338 unsafe fn decode(
339 &mut self,
340 decoder: &mut fidl::encoding::Decoder<'_, D>,
341 offset: usize,
342 _depth: fidl::encoding::Depth,
343 ) -> fidl::Result<()> {
344 decoder.debug_check_bounds::<Self>(offset);
345 let prim = decoder.read_num::<u32>(offset);
346
347 *self = Self::from_primitive_allow_unknown(prim);
348 Ok(())
349 }
350 }
351 unsafe impl fidl::encoding::TypeMarker for LifecycleError {
352 type Owned = Self;
353
354 #[inline(always)]
355 fn inline_align(_context: fidl::encoding::Context) -> usize {
356 std::mem::align_of::<u32>()
357 }
358
359 #[inline(always)]
360 fn inline_size(_context: fidl::encoding::Context) -> usize {
361 std::mem::size_of::<u32>()
362 }
363
364 #[inline(always)]
365 fn encode_is_copy() -> bool {
366 false
367 }
368
369 #[inline(always)]
370 fn decode_is_copy() -> bool {
371 false
372 }
373 }
374
375 impl fidl::encoding::ValueTypeMarker for LifecycleError {
376 type Borrowed<'a> = Self;
377 #[inline(always)]
378 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
379 *value
380 }
381 }
382
383 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for LifecycleError {
384 #[inline]
385 unsafe fn encode(
386 self,
387 encoder: &mut fidl::encoding::Encoder<'_, D>,
388 offset: usize,
389 _depth: fidl::encoding::Depth,
390 ) -> fidl::Result<()> {
391 encoder.debug_check_bounds::<Self>(offset);
392 encoder.write_num(self.into_primitive(), offset);
393 Ok(())
394 }
395 }
396
397 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LifecycleError {
398 #[inline(always)]
399 fn new_empty() -> Self {
400 Self::unknown()
401 }
402
403 #[inline]
404 unsafe fn decode(
405 &mut self,
406 decoder: &mut fidl::encoding::Decoder<'_, D>,
407 offset: usize,
408 _depth: fidl::encoding::Depth,
409 ) -> fidl::Result<()> {
410 decoder.debug_check_bounds::<Self>(offset);
411 let prim = decoder.read_num::<u32>(offset);
412
413 *self = Self::from_primitive_allow_unknown(prim);
414 Ok(())
415 }
416 }
417 unsafe impl fidl::encoding::TypeMarker for RestartError {
418 type Owned = Self;
419
420 #[inline(always)]
421 fn inline_align(_context: fidl::encoding::Context) -> usize {
422 std::mem::align_of::<u32>()
423 }
424
425 #[inline(always)]
426 fn inline_size(_context: fidl::encoding::Context) -> usize {
427 std::mem::size_of::<u32>()
428 }
429
430 #[inline(always)]
431 fn encode_is_copy() -> bool {
432 false
433 }
434
435 #[inline(always)]
436 fn decode_is_copy() -> bool {
437 false
438 }
439 }
440
441 impl fidl::encoding::ValueTypeMarker for RestartError {
442 type Borrowed<'a> = Self;
443 #[inline(always)]
444 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
445 *value
446 }
447 }
448
449 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RestartError {
450 #[inline]
451 unsafe fn encode(
452 self,
453 encoder: &mut fidl::encoding::Encoder<'_, D>,
454 offset: usize,
455 _depth: fidl::encoding::Depth,
456 ) -> fidl::Result<()> {
457 encoder.debug_check_bounds::<Self>(offset);
458 encoder.write_num(self.into_primitive(), offset);
459 Ok(())
460 }
461 }
462
463 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RestartError {
464 #[inline(always)]
465 fn new_empty() -> Self {
466 Self::unknown()
467 }
468
469 #[inline]
470 unsafe fn decode(
471 &mut self,
472 decoder: &mut fidl::encoding::Decoder<'_, D>,
473 offset: usize,
474 _depth: fidl::encoding::Depth,
475 ) -> fidl::Result<()> {
476 decoder.debug_check_bounds::<Self>(offset);
477 let prim = decoder.read_num::<u32>(offset);
478
479 *self = Self::from_primitive_allow_unknown(prim);
480 Ok(())
481 }
482 }
483
484 impl fidl::encoding::ValueTypeMarker for LauncherLaunchRequest {
485 type Borrowed<'a> = &'a Self;
486 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
487 value
488 }
489 }
490
491 unsafe impl fidl::encoding::TypeMarker for LauncherLaunchRequest {
492 type Owned = Self;
493
494 #[inline(always)]
495 fn inline_align(_context: fidl::encoding::Context) -> usize {
496 8
497 }
498
499 #[inline(always)]
500 fn inline_size(_context: fidl::encoding::Context) -> usize {
501 16
502 }
503 }
504
505 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LauncherLaunchRequest, D>
506 for &LauncherLaunchRequest
507 {
508 #[inline]
509 unsafe fn encode(
510 self,
511 encoder: &mut fidl::encoding::Encoder<'_, D>,
512 offset: usize,
513 _depth: fidl::encoding::Depth,
514 ) -> fidl::Result<()> {
515 encoder.debug_check_bounds::<LauncherLaunchRequest>(offset);
516 fidl::encoding::Encode::<LauncherLaunchRequest, D>::encode(
518 (<LaunchConfiguration as fidl::encoding::ValueTypeMarker>::borrow(
519 &self.configuration,
520 ),),
521 encoder,
522 offset,
523 _depth,
524 )
525 }
526 }
527 unsafe impl<
528 D: fidl::encoding::ResourceDialect,
529 T0: fidl::encoding::Encode<LaunchConfiguration, D>,
530 > fidl::encoding::Encode<LauncherLaunchRequest, D> for (T0,)
531 {
532 #[inline]
533 unsafe fn encode(
534 self,
535 encoder: &mut fidl::encoding::Encoder<'_, D>,
536 offset: usize,
537 depth: fidl::encoding::Depth,
538 ) -> fidl::Result<()> {
539 encoder.debug_check_bounds::<LauncherLaunchRequest>(offset);
540 self.0.encode(encoder, offset + 0, depth)?;
544 Ok(())
545 }
546 }
547
548 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LauncherLaunchRequest {
549 #[inline(always)]
550 fn new_empty() -> Self {
551 Self { configuration: fidl::new_empty!(LaunchConfiguration, D) }
552 }
553
554 #[inline]
555 unsafe fn decode(
556 &mut self,
557 decoder: &mut fidl::encoding::Decoder<'_, D>,
558 offset: usize,
559 _depth: fidl::encoding::Depth,
560 ) -> fidl::Result<()> {
561 decoder.debug_check_bounds::<Self>(offset);
562 fidl::decode!(
564 LaunchConfiguration,
565 D,
566 &mut self.configuration,
567 decoder,
568 offset + 0,
569 _depth
570 )?;
571 Ok(())
572 }
573 }
574
575 impl LaunchConfiguration {
576 #[inline(always)]
577 fn max_ordinal_present(&self) -> u64 {
578 if let Some(_) = self.config_capabilities {
579 return 2;
580 }
581 if let Some(_) = self.session_url {
582 return 1;
583 }
584 0
585 }
586 }
587
588 impl fidl::encoding::ValueTypeMarker for LaunchConfiguration {
589 type Borrowed<'a> = &'a Self;
590 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
591 value
592 }
593 }
594
595 unsafe impl fidl::encoding::TypeMarker for LaunchConfiguration {
596 type Owned = Self;
597
598 #[inline(always)]
599 fn inline_align(_context: fidl::encoding::Context) -> usize {
600 8
601 }
602
603 #[inline(always)]
604 fn inline_size(_context: fidl::encoding::Context) -> usize {
605 16
606 }
607 }
608
609 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LaunchConfiguration, D>
610 for &LaunchConfiguration
611 {
612 unsafe fn encode(
613 self,
614 encoder: &mut fidl::encoding::Encoder<'_, D>,
615 offset: usize,
616 mut depth: fidl::encoding::Depth,
617 ) -> fidl::Result<()> {
618 encoder.debug_check_bounds::<LaunchConfiguration>(offset);
619 let max_ordinal: u64 = self.max_ordinal_present();
621 encoder.write_num(max_ordinal, offset);
622 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
623 if max_ordinal == 0 {
625 return Ok(());
626 }
627 depth.increment()?;
628 let envelope_size = 8;
629 let bytes_len = max_ordinal as usize * envelope_size;
630 #[allow(unused_variables)]
631 let offset = encoder.out_of_line_offset(bytes_len);
632 let mut _prev_end_offset: usize = 0;
633 if 1 > max_ordinal {
634 return Ok(());
635 }
636
637 let cur_offset: usize = (1 - 1) * envelope_size;
640
641 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
643
644 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, D>(
649 self.session_url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
650 encoder, offset + cur_offset, depth
651 )?;
652
653 _prev_end_offset = cur_offset + envelope_size;
654 if 2 > max_ordinal {
655 return Ok(());
656 }
657
658 let cur_offset: usize = (2 - 1) * envelope_size;
661
662 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
664
665 fidl::encoding::encode_in_envelope_optional::<
670 fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl__common::Configuration>,
671 D,
672 >(
673 self.config_capabilities.as_ref().map(
674 <fidl::encoding::UnboundedVector<
675 fidl_fuchsia_component_decl__common::Configuration,
676 > as fidl::encoding::ValueTypeMarker>::borrow,
677 ),
678 encoder,
679 offset + cur_offset,
680 depth,
681 )?;
682
683 _prev_end_offset = cur_offset + envelope_size;
684
685 Ok(())
686 }
687 }
688
689 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LaunchConfiguration {
690 #[inline(always)]
691 fn new_empty() -> Self {
692 Self::default()
693 }
694
695 unsafe fn decode(
696 &mut self,
697 decoder: &mut fidl::encoding::Decoder<'_, D>,
698 offset: usize,
699 mut depth: fidl::encoding::Depth,
700 ) -> fidl::Result<()> {
701 decoder.debug_check_bounds::<Self>(offset);
702 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
703 None => return Err(fidl::Error::NotNullable),
704 Some(len) => len,
705 };
706 if len == 0 {
708 return Ok(());
709 };
710 depth.increment()?;
711 let envelope_size = 8;
712 let bytes_len = len * envelope_size;
713 let offset = decoder.out_of_line_offset(bytes_len)?;
714 let mut _next_ordinal_to_read = 0;
716 let mut next_offset = offset;
717 let end_offset = offset + bytes_len;
718 _next_ordinal_to_read += 1;
719 if next_offset >= end_offset {
720 return Ok(());
721 }
722
723 while _next_ordinal_to_read < 1 {
725 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
726 _next_ordinal_to_read += 1;
727 next_offset += envelope_size;
728 }
729
730 let next_out_of_line = decoder.next_out_of_line();
731 let handles_before = decoder.remaining_handles();
732 if let Some((inlined, num_bytes, num_handles)) =
733 fidl::encoding::decode_envelope_header(decoder, next_offset)?
734 {
735 let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
736 if inlined != (member_inline_size <= 4) {
737 return Err(fidl::Error::InvalidInlineBitInEnvelope);
738 }
739 let inner_offset;
740 let mut inner_depth = depth.clone();
741 if inlined {
742 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
743 inner_offset = next_offset;
744 } else {
745 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
746 inner_depth.increment()?;
747 }
748 let val_ref = self.session_url.get_or_insert_with(|| {
749 fidl::new_empty!(fidl::encoding::BoundedString<4096>, D)
750 });
751 fidl::decode!(
752 fidl::encoding::BoundedString<4096>,
753 D,
754 val_ref,
755 decoder,
756 inner_offset,
757 inner_depth
758 )?;
759 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
760 {
761 return Err(fidl::Error::InvalidNumBytesInEnvelope);
762 }
763 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
764 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
765 }
766 }
767
768 next_offset += envelope_size;
769 _next_ordinal_to_read += 1;
770 if next_offset >= end_offset {
771 return Ok(());
772 }
773
774 while _next_ordinal_to_read < 2 {
776 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
777 _next_ordinal_to_read += 1;
778 next_offset += envelope_size;
779 }
780
781 let next_out_of_line = decoder.next_out_of_line();
782 let handles_before = decoder.remaining_handles();
783 if let Some((inlined, num_bytes, num_handles)) =
784 fidl::encoding::decode_envelope_header(decoder, next_offset)?
785 {
786 let member_inline_size = <fidl::encoding::UnboundedVector<
787 fidl_fuchsia_component_decl__common::Configuration,
788 > as fidl::encoding::TypeMarker>::inline_size(
789 decoder.context
790 );
791 if inlined != (member_inline_size <= 4) {
792 return Err(fidl::Error::InvalidInlineBitInEnvelope);
793 }
794 let inner_offset;
795 let mut inner_depth = depth.clone();
796 if inlined {
797 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
798 inner_offset = next_offset;
799 } else {
800 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
801 inner_depth.increment()?;
802 }
803 let val_ref = self.config_capabilities.get_or_insert_with(|| {
804 fidl::new_empty!(
805 fidl::encoding::UnboundedVector<
806 fidl_fuchsia_component_decl__common::Configuration,
807 >,
808 D
809 )
810 });
811 fidl::decode!(
812 fidl::encoding::UnboundedVector<
813 fidl_fuchsia_component_decl__common::Configuration,
814 >,
815 D,
816 val_ref,
817 decoder,
818 inner_offset,
819 inner_depth
820 )?;
821 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
822 {
823 return Err(fidl::Error::InvalidNumBytesInEnvelope);
824 }
825 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
826 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
827 }
828 }
829
830 next_offset += envelope_size;
831
832 while next_offset < end_offset {
834 _next_ordinal_to_read += 1;
835 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
836 next_offset += envelope_size;
837 }
838
839 Ok(())
840 }
841 }
842
843 impl LifecycleStartRequest {
844 #[inline(always)]
845 fn max_ordinal_present(&self) -> u64 {
846 if let Some(_) = self.session_url {
847 return 1;
848 }
849 0
850 }
851 }
852
853 impl fidl::encoding::ValueTypeMarker for LifecycleStartRequest {
854 type Borrowed<'a> = &'a Self;
855 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
856 value
857 }
858 }
859
860 unsafe impl fidl::encoding::TypeMarker for LifecycleStartRequest {
861 type Owned = Self;
862
863 #[inline(always)]
864 fn inline_align(_context: fidl::encoding::Context) -> usize {
865 8
866 }
867
868 #[inline(always)]
869 fn inline_size(_context: fidl::encoding::Context) -> usize {
870 16
871 }
872 }
873
874 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LifecycleStartRequest, D>
875 for &LifecycleStartRequest
876 {
877 unsafe fn encode(
878 self,
879 encoder: &mut fidl::encoding::Encoder<'_, D>,
880 offset: usize,
881 mut depth: fidl::encoding::Depth,
882 ) -> fidl::Result<()> {
883 encoder.debug_check_bounds::<LifecycleStartRequest>(offset);
884 let max_ordinal: u64 = self.max_ordinal_present();
886 encoder.write_num(max_ordinal, offset);
887 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
888 if max_ordinal == 0 {
890 return Ok(());
891 }
892 depth.increment()?;
893 let envelope_size = 8;
894 let bytes_len = max_ordinal as usize * envelope_size;
895 #[allow(unused_variables)]
896 let offset = encoder.out_of_line_offset(bytes_len);
897 let mut _prev_end_offset: usize = 0;
898 if 1 > max_ordinal {
899 return Ok(());
900 }
901
902 let cur_offset: usize = (1 - 1) * envelope_size;
905
906 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
908
909 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, D>(
914 self.session_url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
915 encoder, offset + cur_offset, depth
916 )?;
917
918 _prev_end_offset = cur_offset + envelope_size;
919
920 Ok(())
921 }
922 }
923
924 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LifecycleStartRequest {
925 #[inline(always)]
926 fn new_empty() -> Self {
927 Self::default()
928 }
929
930 unsafe fn decode(
931 &mut self,
932 decoder: &mut fidl::encoding::Decoder<'_, D>,
933 offset: usize,
934 mut depth: fidl::encoding::Depth,
935 ) -> fidl::Result<()> {
936 decoder.debug_check_bounds::<Self>(offset);
937 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
938 None => return Err(fidl::Error::NotNullable),
939 Some(len) => len,
940 };
941 if len == 0 {
943 return Ok(());
944 };
945 depth.increment()?;
946 let envelope_size = 8;
947 let bytes_len = len * envelope_size;
948 let offset = decoder.out_of_line_offset(bytes_len)?;
949 let mut _next_ordinal_to_read = 0;
951 let mut next_offset = offset;
952 let end_offset = offset + bytes_len;
953 _next_ordinal_to_read += 1;
954 if next_offset >= end_offset {
955 return Ok(());
956 }
957
958 while _next_ordinal_to_read < 1 {
960 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
961 _next_ordinal_to_read += 1;
962 next_offset += envelope_size;
963 }
964
965 let next_out_of_line = decoder.next_out_of_line();
966 let handles_before = decoder.remaining_handles();
967 if let Some((inlined, num_bytes, num_handles)) =
968 fidl::encoding::decode_envelope_header(decoder, next_offset)?
969 {
970 let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
971 if inlined != (member_inline_size <= 4) {
972 return Err(fidl::Error::InvalidInlineBitInEnvelope);
973 }
974 let inner_offset;
975 let mut inner_depth = depth.clone();
976 if inlined {
977 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
978 inner_offset = next_offset;
979 } else {
980 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
981 inner_depth.increment()?;
982 }
983 let val_ref = self.session_url.get_or_insert_with(|| {
984 fidl::new_empty!(fidl::encoding::BoundedString<4096>, D)
985 });
986 fidl::decode!(
987 fidl::encoding::BoundedString<4096>,
988 D,
989 val_ref,
990 decoder,
991 inner_offset,
992 inner_depth
993 )?;
994 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
995 {
996 return Err(fidl::Error::InvalidNumBytesInEnvelope);
997 }
998 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
999 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1000 }
1001 }
1002
1003 next_offset += envelope_size;
1004
1005 while next_offset < end_offset {
1007 _next_ordinal_to_read += 1;
1008 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1009 next_offset += envelope_size;
1010 }
1011
1012 Ok(())
1013 }
1014 }
1015}