1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_developer_console_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct PackageProgram {
16 pub package: fidl_fuchsia_component_resolution::Package,
18 pub path: String,
21}
22
23impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PackageProgram {}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct RawHandles {
27 pub stdin: Option<fidl::NullableHandle>,
28 pub stdout: Option<fidl::NullableHandle>,
29 pub stderr: Option<fidl::NullableHandle>,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RawHandles {}
33
34#[derive(Debug, Default, PartialEq)]
36pub struct LaunchOptions {
37 pub name: Option<String>,
41 pub args: Option<Vec<String>>,
47 pub program: Option<Program>,
51 pub io_handles: Option<IoHandles>,
55 pub env: Option<Vec<String>>,
59 pub namespace_entries: Option<Vec<fidl_fuchsia_process::NameInfo>>,
69 pub stopper: Option<fidl::EventPair>,
75 pub directories_fixup: Option<bool>,
92 #[doc(hidden)]
93 pub __source_breaking: fidl::marker::SourceBreaking,
94}
95
96impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LaunchOptions {}
97
98#[derive(Debug)]
99pub enum IoHandles {
100 RawHandles(RawHandles),
102 PtySocket(fidl::Socket),
106 #[doc(hidden)]
107 __SourceBreaking { unknown_ordinal: u64 },
108}
109
110#[macro_export]
112macro_rules! IoHandlesUnknown {
113 () => {
114 _
115 };
116}
117
118impl PartialEq for IoHandles {
120 fn eq(&self, other: &Self) -> bool {
121 match (self, other) {
122 (Self::RawHandles(x), Self::RawHandles(y)) => *x == *y,
123 (Self::PtySocket(x), Self::PtySocket(y)) => *x == *y,
124 _ => false,
125 }
126 }
127}
128
129impl IoHandles {
130 #[inline]
131 pub fn ordinal(&self) -> u64 {
132 match *self {
133 Self::RawHandles(_) => 1,
134 Self::PtySocket(_) => 2,
135 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
136 }
137 }
138
139 #[inline]
140 pub fn unknown_variant_for_testing() -> Self {
141 Self::__SourceBreaking { unknown_ordinal: 0 }
142 }
143
144 #[inline]
145 pub fn is_unknown(&self) -> bool {
146 match self {
147 Self::__SourceBreaking { .. } => true,
148 _ => false,
149 }
150 }
151}
152
153impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for IoHandles {}
154
155#[derive(Debug)]
156pub enum Program {
157 DefaultShell(Empty),
166 FromPackage(PackageProgram),
171 #[doc(hidden)]
172 __SourceBreaking { unknown_ordinal: u64 },
173}
174
175#[macro_export]
177macro_rules! ProgramUnknown {
178 () => {
179 _
180 };
181}
182
183impl PartialEq for Program {
185 fn eq(&self, other: &Self) -> bool {
186 match (self, other) {
187 (Self::DefaultShell(x), Self::DefaultShell(y)) => *x == *y,
188 (Self::FromPackage(x), Self::FromPackage(y)) => *x == *y,
189 _ => false,
190 }
191 }
192}
193
194impl Program {
195 #[inline]
196 pub fn ordinal(&self) -> u64 {
197 match *self {
198 Self::DefaultShell(_) => 1,
199 Self::FromPackage(_) => 2,
200 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
201 }
202 }
203
204 #[inline]
205 pub fn unknown_variant_for_testing() -> Self {
206 Self::__SourceBreaking { unknown_ordinal: 0 }
207 }
208
209 #[inline]
210 pub fn is_unknown(&self) -> bool {
211 match self {
212 Self::__SourceBreaking { .. } => true,
213 _ => false,
214 }
215 }
216}
217
218impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Program {}
219
220#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
221pub struct LauncherMarker;
222
223impl fidl::endpoints::ProtocolMarker for LauncherMarker {
224 type Proxy = LauncherProxy;
225 type RequestStream = LauncherRequestStream;
226 #[cfg(target_os = "fuchsia")]
227 type SynchronousProxy = LauncherSynchronousProxy;
228
229 const DEBUG_NAME: &'static str = "fuchsia.developer.console.Launcher";
230}
231impl fidl::endpoints::DiscoverableProtocolMarker for LauncherMarker {}
232pub type LauncherLaunchResult = Result<i64, LauncherError>;
233
234pub trait LauncherProxyInterface: Send + Sync {
235 type LaunchResponseFut: std::future::Future<Output = Result<LauncherLaunchResult, fidl::Error>>
236 + Send;
237 fn r#launch(&self, payload: LaunchOptions) -> Self::LaunchResponseFut;
238}
239#[derive(Debug)]
240#[cfg(target_os = "fuchsia")]
241pub struct LauncherSynchronousProxy {
242 client: fidl::client::sync::Client,
243}
244
245#[cfg(target_os = "fuchsia")]
246impl fidl::endpoints::SynchronousProxy for LauncherSynchronousProxy {
247 type Proxy = LauncherProxy;
248 type Protocol = LauncherMarker;
249
250 fn from_channel(inner: fidl::Channel) -> Self {
251 Self::new(inner)
252 }
253
254 fn into_channel(self) -> fidl::Channel {
255 self.client.into_channel()
256 }
257
258 fn as_channel(&self) -> &fidl::Channel {
259 self.client.as_channel()
260 }
261}
262
263#[cfg(target_os = "fuchsia")]
264impl LauncherSynchronousProxy {
265 pub fn new(channel: fidl::Channel) -> Self {
266 Self { client: fidl::client::sync::Client::new(channel) }
267 }
268
269 pub fn into_channel(self) -> fidl::Channel {
270 self.client.into_channel()
271 }
272
273 pub fn wait_for_event(
276 &self,
277 deadline: zx::MonotonicInstant,
278 ) -> Result<LauncherEvent, fidl::Error> {
279 LauncherEvent::decode(self.client.wait_for_event::<LauncherMarker>(deadline)?)
280 }
281
282 pub fn r#launch(
287 &self,
288 mut payload: LaunchOptions,
289 ___deadline: zx::MonotonicInstant,
290 ) -> Result<LauncherLaunchResult, fidl::Error> {
291 let _response = self.client.send_query::<LaunchOptions, fidl::encoding::ResultType<
292 LauncherLaunchResponse,
293 LauncherError,
294 >, LauncherMarker>(
295 &mut payload,
296 0x54051bc8d2beffac,
297 fidl::encoding::DynamicFlags::empty(),
298 ___deadline,
299 )?;
300 Ok(_response.map(|x| x.return_code))
301 }
302}
303
304#[cfg(target_os = "fuchsia")]
305impl From<LauncherSynchronousProxy> for zx::NullableHandle {
306 fn from(value: LauncherSynchronousProxy) -> Self {
307 value.into_channel().into()
308 }
309}
310
311#[cfg(target_os = "fuchsia")]
312impl From<fidl::Channel> for LauncherSynchronousProxy {
313 fn from(value: fidl::Channel) -> Self {
314 Self::new(value)
315 }
316}
317
318#[cfg(target_os = "fuchsia")]
319impl fidl::endpoints::FromClient for LauncherSynchronousProxy {
320 type Protocol = LauncherMarker;
321
322 fn from_client(value: fidl::endpoints::ClientEnd<LauncherMarker>) -> Self {
323 Self::new(value.into_channel())
324 }
325}
326
327#[derive(Debug, Clone)]
328pub struct LauncherProxy {
329 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
330}
331
332impl fidl::endpoints::Proxy for LauncherProxy {
333 type Protocol = LauncherMarker;
334
335 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
336 Self::new(inner)
337 }
338
339 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
340 self.client.into_channel().map_err(|client| Self { client })
341 }
342
343 fn as_channel(&self) -> &::fidl::AsyncChannel {
344 self.client.as_channel()
345 }
346}
347
348impl LauncherProxy {
349 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
351 let protocol_name = <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
352 Self { client: fidl::client::Client::new(channel, protocol_name) }
353 }
354
355 pub fn take_event_stream(&self) -> LauncherEventStream {
361 LauncherEventStream { event_receiver: self.client.take_event_receiver() }
362 }
363
364 pub fn r#launch(
369 &self,
370 mut payload: LaunchOptions,
371 ) -> fidl::client::QueryResponseFut<
372 LauncherLaunchResult,
373 fidl::encoding::DefaultFuchsiaResourceDialect,
374 > {
375 LauncherProxyInterface::r#launch(self, payload)
376 }
377}
378
379impl LauncherProxyInterface for LauncherProxy {
380 type LaunchResponseFut = fidl::client::QueryResponseFut<
381 LauncherLaunchResult,
382 fidl::encoding::DefaultFuchsiaResourceDialect,
383 >;
384 fn r#launch(&self, mut payload: LaunchOptions) -> Self::LaunchResponseFut {
385 fn _decode(
386 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
387 ) -> Result<LauncherLaunchResult, fidl::Error> {
388 let _response = fidl::client::decode_transaction_body::<
389 fidl::encoding::ResultType<LauncherLaunchResponse, LauncherError>,
390 fidl::encoding::DefaultFuchsiaResourceDialect,
391 0x54051bc8d2beffac,
392 >(_buf?)?;
393 Ok(_response.map(|x| x.return_code))
394 }
395 self.client.send_query_and_decode::<LaunchOptions, LauncherLaunchResult>(
396 &mut payload,
397 0x54051bc8d2beffac,
398 fidl::encoding::DynamicFlags::empty(),
399 _decode,
400 )
401 }
402}
403
404pub struct LauncherEventStream {
405 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
406}
407
408impl std::marker::Unpin for LauncherEventStream {}
409
410impl futures::stream::FusedStream for LauncherEventStream {
411 fn is_terminated(&self) -> bool {
412 self.event_receiver.is_terminated()
413 }
414}
415
416impl futures::Stream for LauncherEventStream {
417 type Item = Result<LauncherEvent, fidl::Error>;
418
419 fn poll_next(
420 mut self: std::pin::Pin<&mut Self>,
421 cx: &mut std::task::Context<'_>,
422 ) -> std::task::Poll<Option<Self::Item>> {
423 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
424 &mut self.event_receiver,
425 cx
426 )?) {
427 Some(buf) => std::task::Poll::Ready(Some(LauncherEvent::decode(buf))),
428 None => std::task::Poll::Ready(None),
429 }
430 }
431}
432
433#[derive(Debug)]
434pub enum LauncherEvent {
435 #[non_exhaustive]
436 _UnknownEvent {
437 ordinal: u64,
439 },
440}
441
442impl LauncherEvent {
443 fn decode(
445 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
446 ) -> Result<LauncherEvent, fidl::Error> {
447 let (bytes, _handles) = buf.split_mut();
448 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
449 debug_assert_eq!(tx_header.tx_id, 0);
450 match tx_header.ordinal {
451 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
452 Ok(LauncherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
453 }
454 _ => Err(fidl::Error::UnknownOrdinal {
455 ordinal: tx_header.ordinal,
456 protocol_name: <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
457 }),
458 }
459 }
460}
461
462pub struct LauncherRequestStream {
464 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
465 is_terminated: bool,
466}
467
468impl std::marker::Unpin for LauncherRequestStream {}
469
470impl futures::stream::FusedStream for LauncherRequestStream {
471 fn is_terminated(&self) -> bool {
472 self.is_terminated
473 }
474}
475
476impl fidl::endpoints::RequestStream for LauncherRequestStream {
477 type Protocol = LauncherMarker;
478 type ControlHandle = LauncherControlHandle;
479
480 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
481 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
482 }
483
484 fn control_handle(&self) -> Self::ControlHandle {
485 LauncherControlHandle { inner: self.inner.clone() }
486 }
487
488 fn into_inner(
489 self,
490 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
491 {
492 (self.inner, self.is_terminated)
493 }
494
495 fn from_inner(
496 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
497 is_terminated: bool,
498 ) -> Self {
499 Self { inner, is_terminated }
500 }
501}
502
503impl futures::Stream for LauncherRequestStream {
504 type Item = Result<LauncherRequest, fidl::Error>;
505
506 fn poll_next(
507 mut self: std::pin::Pin<&mut Self>,
508 cx: &mut std::task::Context<'_>,
509 ) -> std::task::Poll<Option<Self::Item>> {
510 let this = &mut *self;
511 if this.inner.check_shutdown(cx) {
512 this.is_terminated = true;
513 return std::task::Poll::Ready(None);
514 }
515 if this.is_terminated {
516 panic!("polled LauncherRequestStream after completion");
517 }
518 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
519 |bytes, handles| {
520 match this.inner.channel().read_etc(cx, bytes, handles) {
521 std::task::Poll::Ready(Ok(())) => {}
522 std::task::Poll::Pending => return std::task::Poll::Pending,
523 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
524 this.is_terminated = true;
525 return std::task::Poll::Ready(None);
526 }
527 std::task::Poll::Ready(Err(e)) => {
528 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
529 e.into(),
530 ))));
531 }
532 }
533
534 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
536
537 std::task::Poll::Ready(Some(match header.ordinal {
538 0x54051bc8d2beffac => {
539 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
540 let mut req = fidl::new_empty!(
541 LaunchOptions,
542 fidl::encoding::DefaultFuchsiaResourceDialect
543 );
544 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LaunchOptions>(&header, _body_bytes, handles, &mut req)?;
545 let control_handle = LauncherControlHandle { inner: this.inner.clone() };
546 Ok(LauncherRequest::Launch {
547 payload: req,
548 responder: LauncherLaunchResponder {
549 control_handle: std::mem::ManuallyDrop::new(control_handle),
550 tx_id: header.tx_id,
551 },
552 })
553 }
554 _ if header.tx_id == 0
555 && header
556 .dynamic_flags()
557 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
558 {
559 Ok(LauncherRequest::_UnknownMethod {
560 ordinal: header.ordinal,
561 control_handle: LauncherControlHandle { inner: this.inner.clone() },
562 method_type: fidl::MethodType::OneWay,
563 })
564 }
565 _ if header
566 .dynamic_flags()
567 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
568 {
569 this.inner.send_framework_err(
570 fidl::encoding::FrameworkErr::UnknownMethod,
571 header.tx_id,
572 header.ordinal,
573 header.dynamic_flags(),
574 (bytes, handles),
575 )?;
576 Ok(LauncherRequest::_UnknownMethod {
577 ordinal: header.ordinal,
578 control_handle: LauncherControlHandle { inner: this.inner.clone() },
579 method_type: fidl::MethodType::TwoWay,
580 })
581 }
582 _ => Err(fidl::Error::UnknownOrdinal {
583 ordinal: header.ordinal,
584 protocol_name:
585 <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
586 }),
587 }))
588 },
589 )
590 }
591}
592
593#[derive(Debug)]
594pub enum LauncherRequest {
595 Launch { payload: LaunchOptions, responder: LauncherLaunchResponder },
600 #[non_exhaustive]
602 _UnknownMethod {
603 ordinal: u64,
605 control_handle: LauncherControlHandle,
606 method_type: fidl::MethodType,
607 },
608}
609
610impl LauncherRequest {
611 #[allow(irrefutable_let_patterns)]
612 pub fn into_launch(self) -> Option<(LaunchOptions, LauncherLaunchResponder)> {
613 if let LauncherRequest::Launch { payload, responder } = self {
614 Some((payload, responder))
615 } else {
616 None
617 }
618 }
619
620 pub fn method_name(&self) -> &'static str {
622 match *self {
623 LauncherRequest::Launch { .. } => "launch",
624 LauncherRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
625 "unknown one-way method"
626 }
627 LauncherRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
628 "unknown two-way method"
629 }
630 }
631 }
632}
633
634#[derive(Debug, Clone)]
635pub struct LauncherControlHandle {
636 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
637}
638
639impl LauncherControlHandle {
640 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
641 self.inner.shutdown_with_epitaph(status.into())
642 }
643}
644
645impl fidl::endpoints::ControlHandle for LauncherControlHandle {
646 fn shutdown(&self) {
647 self.inner.shutdown()
648 }
649
650 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
651 self.inner.shutdown_with_epitaph(status)
652 }
653
654 fn is_closed(&self) -> bool {
655 self.inner.channel().is_closed()
656 }
657 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
658 self.inner.channel().on_closed()
659 }
660
661 #[cfg(target_os = "fuchsia")]
662 fn signal_peer(
663 &self,
664 clear_mask: zx::Signals,
665 set_mask: zx::Signals,
666 ) -> Result<(), zx_status::Status> {
667 use fidl::Peered;
668 self.inner.channel().signal_peer(clear_mask, set_mask)
669 }
670}
671
672impl LauncherControlHandle {}
673
674#[must_use = "FIDL methods require a response to be sent"]
675#[derive(Debug)]
676pub struct LauncherLaunchResponder {
677 control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
678 tx_id: u32,
679}
680
681impl std::ops::Drop for LauncherLaunchResponder {
685 fn drop(&mut self) {
686 self.control_handle.shutdown();
687 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
689 }
690}
691
692impl fidl::endpoints::Responder for LauncherLaunchResponder {
693 type ControlHandle = LauncherControlHandle;
694
695 fn control_handle(&self) -> &LauncherControlHandle {
696 &self.control_handle
697 }
698
699 fn drop_without_shutdown(mut self) {
700 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
702 std::mem::forget(self);
704 }
705}
706
707impl LauncherLaunchResponder {
708 pub fn send(self, mut result: Result<i64, LauncherError>) -> Result<(), fidl::Error> {
712 let _result = self.send_raw(result);
713 if _result.is_err() {
714 self.control_handle.shutdown();
715 }
716 self.drop_without_shutdown();
717 _result
718 }
719
720 pub fn send_no_shutdown_on_err(
722 self,
723 mut result: Result<i64, LauncherError>,
724 ) -> Result<(), fidl::Error> {
725 let _result = self.send_raw(result);
726 self.drop_without_shutdown();
727 _result
728 }
729
730 fn send_raw(&self, mut result: Result<i64, LauncherError>) -> Result<(), fidl::Error> {
731 self.control_handle
732 .inner
733 .send::<fidl::encoding::ResultType<LauncherLaunchResponse, LauncherError>>(
734 result.map(|return_code| (return_code,)),
735 self.tx_id,
736 0x54051bc8d2beffac,
737 fidl::encoding::DynamicFlags::empty(),
738 )
739 }
740}
741
742mod internal {
743 use super::*;
744
745 impl fidl::encoding::ResourceTypeMarker for PackageProgram {
746 type Borrowed<'a> = &'a mut Self;
747 fn take_or_borrow<'a>(
748 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
749 ) -> Self::Borrowed<'a> {
750 value
751 }
752 }
753
754 unsafe impl fidl::encoding::TypeMarker for PackageProgram {
755 type Owned = Self;
756
757 #[inline(always)]
758 fn inline_align(_context: fidl::encoding::Context) -> usize {
759 8
760 }
761
762 #[inline(always)]
763 fn inline_size(_context: fidl::encoding::Context) -> usize {
764 32
765 }
766 }
767
768 unsafe impl
769 fidl::encoding::Encode<PackageProgram, fidl::encoding::DefaultFuchsiaResourceDialect>
770 for &mut PackageProgram
771 {
772 #[inline]
773 unsafe fn encode(
774 self,
775 encoder: &mut fidl::encoding::Encoder<
776 '_,
777 fidl::encoding::DefaultFuchsiaResourceDialect,
778 >,
779 offset: usize,
780 _depth: fidl::encoding::Depth,
781 ) -> fidl::Result<()> {
782 encoder.debug_check_bounds::<PackageProgram>(offset);
783 fidl::encoding::Encode::<PackageProgram, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
785 (
786 <fidl_fuchsia_component_resolution::Package as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.package),
787 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.path),
788 ),
789 encoder, offset, _depth
790 )
791 }
792 }
793 unsafe impl<
794 T0: fidl::encoding::Encode<
795 fidl_fuchsia_component_resolution::Package,
796 fidl::encoding::DefaultFuchsiaResourceDialect,
797 >,
798 T1: fidl::encoding::Encode<
799 fidl::encoding::UnboundedString,
800 fidl::encoding::DefaultFuchsiaResourceDialect,
801 >,
802 > fidl::encoding::Encode<PackageProgram, fidl::encoding::DefaultFuchsiaResourceDialect>
803 for (T0, T1)
804 {
805 #[inline]
806 unsafe fn encode(
807 self,
808 encoder: &mut fidl::encoding::Encoder<
809 '_,
810 fidl::encoding::DefaultFuchsiaResourceDialect,
811 >,
812 offset: usize,
813 depth: fidl::encoding::Depth,
814 ) -> fidl::Result<()> {
815 encoder.debug_check_bounds::<PackageProgram>(offset);
816 self.0.encode(encoder, offset + 0, depth)?;
820 self.1.encode(encoder, offset + 16, depth)?;
821 Ok(())
822 }
823 }
824
825 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
826 for PackageProgram
827 {
828 #[inline(always)]
829 fn new_empty() -> Self {
830 Self {
831 package: fidl::new_empty!(
832 fidl_fuchsia_component_resolution::Package,
833 fidl::encoding::DefaultFuchsiaResourceDialect
834 ),
835 path: fidl::new_empty!(
836 fidl::encoding::UnboundedString,
837 fidl::encoding::DefaultFuchsiaResourceDialect
838 ),
839 }
840 }
841
842 #[inline]
843 unsafe fn decode(
844 &mut self,
845 decoder: &mut fidl::encoding::Decoder<
846 '_,
847 fidl::encoding::DefaultFuchsiaResourceDialect,
848 >,
849 offset: usize,
850 _depth: fidl::encoding::Depth,
851 ) -> fidl::Result<()> {
852 decoder.debug_check_bounds::<Self>(offset);
853 fidl::decode!(
855 fidl_fuchsia_component_resolution::Package,
856 fidl::encoding::DefaultFuchsiaResourceDialect,
857 &mut self.package,
858 decoder,
859 offset + 0,
860 _depth
861 )?;
862 fidl::decode!(
863 fidl::encoding::UnboundedString,
864 fidl::encoding::DefaultFuchsiaResourceDialect,
865 &mut self.path,
866 decoder,
867 offset + 16,
868 _depth
869 )?;
870 Ok(())
871 }
872 }
873
874 impl fidl::encoding::ResourceTypeMarker for RawHandles {
875 type Borrowed<'a> = &'a mut Self;
876 fn take_or_borrow<'a>(
877 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
878 ) -> Self::Borrowed<'a> {
879 value
880 }
881 }
882
883 unsafe impl fidl::encoding::TypeMarker for RawHandles {
884 type Owned = Self;
885
886 #[inline(always)]
887 fn inline_align(_context: fidl::encoding::Context) -> usize {
888 4
889 }
890
891 #[inline(always)]
892 fn inline_size(_context: fidl::encoding::Context) -> usize {
893 12
894 }
895 }
896
897 unsafe impl fidl::encoding::Encode<RawHandles, fidl::encoding::DefaultFuchsiaResourceDialect>
898 for &mut RawHandles
899 {
900 #[inline]
901 unsafe fn encode(
902 self,
903 encoder: &mut fidl::encoding::Encoder<
904 '_,
905 fidl::encoding::DefaultFuchsiaResourceDialect,
906 >,
907 offset: usize,
908 _depth: fidl::encoding::Depth,
909 ) -> fidl::Result<()> {
910 encoder.debug_check_bounds::<RawHandles>(offset);
911 fidl::encoding::Encode::<RawHandles, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
913 (
914 <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stdin),
915 <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stdout),
916 <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stderr),
917 ),
918 encoder, offset, _depth
919 )
920 }
921 }
922 unsafe impl<
923 T0: fidl::encoding::Encode<
924 fidl::encoding::Optional<
925 fidl::encoding::HandleType<
926 fidl::NullableHandle,
927 { fidl::ObjectType::NONE.into_raw() },
928 2147483648,
929 >,
930 >,
931 fidl::encoding::DefaultFuchsiaResourceDialect,
932 >,
933 T1: fidl::encoding::Encode<
934 fidl::encoding::Optional<
935 fidl::encoding::HandleType<
936 fidl::NullableHandle,
937 { fidl::ObjectType::NONE.into_raw() },
938 2147483648,
939 >,
940 >,
941 fidl::encoding::DefaultFuchsiaResourceDialect,
942 >,
943 T2: fidl::encoding::Encode<
944 fidl::encoding::Optional<
945 fidl::encoding::HandleType<
946 fidl::NullableHandle,
947 { fidl::ObjectType::NONE.into_raw() },
948 2147483648,
949 >,
950 >,
951 fidl::encoding::DefaultFuchsiaResourceDialect,
952 >,
953 > fidl::encoding::Encode<RawHandles, fidl::encoding::DefaultFuchsiaResourceDialect>
954 for (T0, T1, T2)
955 {
956 #[inline]
957 unsafe fn encode(
958 self,
959 encoder: &mut fidl::encoding::Encoder<
960 '_,
961 fidl::encoding::DefaultFuchsiaResourceDialect,
962 >,
963 offset: usize,
964 depth: fidl::encoding::Depth,
965 ) -> fidl::Result<()> {
966 encoder.debug_check_bounds::<RawHandles>(offset);
967 self.0.encode(encoder, offset + 0, depth)?;
971 self.1.encode(encoder, offset + 4, depth)?;
972 self.2.encode(encoder, offset + 8, depth)?;
973 Ok(())
974 }
975 }
976
977 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RawHandles {
978 #[inline(always)]
979 fn new_empty() -> Self {
980 Self {
981 stdin: fidl::new_empty!(
982 fidl::encoding::Optional<
983 fidl::encoding::HandleType<
984 fidl::NullableHandle,
985 { fidl::ObjectType::NONE.into_raw() },
986 2147483648,
987 >,
988 >,
989 fidl::encoding::DefaultFuchsiaResourceDialect
990 ),
991 stdout: fidl::new_empty!(
992 fidl::encoding::Optional<
993 fidl::encoding::HandleType<
994 fidl::NullableHandle,
995 { fidl::ObjectType::NONE.into_raw() },
996 2147483648,
997 >,
998 >,
999 fidl::encoding::DefaultFuchsiaResourceDialect
1000 ),
1001 stderr: fidl::new_empty!(
1002 fidl::encoding::Optional<
1003 fidl::encoding::HandleType<
1004 fidl::NullableHandle,
1005 { fidl::ObjectType::NONE.into_raw() },
1006 2147483648,
1007 >,
1008 >,
1009 fidl::encoding::DefaultFuchsiaResourceDialect
1010 ),
1011 }
1012 }
1013
1014 #[inline]
1015 unsafe fn decode(
1016 &mut self,
1017 decoder: &mut fidl::encoding::Decoder<
1018 '_,
1019 fidl::encoding::DefaultFuchsiaResourceDialect,
1020 >,
1021 offset: usize,
1022 _depth: fidl::encoding::Depth,
1023 ) -> fidl::Result<()> {
1024 decoder.debug_check_bounds::<Self>(offset);
1025 fidl::decode!(
1027 fidl::encoding::Optional<
1028 fidl::encoding::HandleType<
1029 fidl::NullableHandle,
1030 { fidl::ObjectType::NONE.into_raw() },
1031 2147483648,
1032 >,
1033 >,
1034 fidl::encoding::DefaultFuchsiaResourceDialect,
1035 &mut self.stdin,
1036 decoder,
1037 offset + 0,
1038 _depth
1039 )?;
1040 fidl::decode!(
1041 fidl::encoding::Optional<
1042 fidl::encoding::HandleType<
1043 fidl::NullableHandle,
1044 { fidl::ObjectType::NONE.into_raw() },
1045 2147483648,
1046 >,
1047 >,
1048 fidl::encoding::DefaultFuchsiaResourceDialect,
1049 &mut self.stdout,
1050 decoder,
1051 offset + 4,
1052 _depth
1053 )?;
1054 fidl::decode!(
1055 fidl::encoding::Optional<
1056 fidl::encoding::HandleType<
1057 fidl::NullableHandle,
1058 { fidl::ObjectType::NONE.into_raw() },
1059 2147483648,
1060 >,
1061 >,
1062 fidl::encoding::DefaultFuchsiaResourceDialect,
1063 &mut self.stderr,
1064 decoder,
1065 offset + 8,
1066 _depth
1067 )?;
1068 Ok(())
1069 }
1070 }
1071
1072 impl LaunchOptions {
1073 #[inline(always)]
1074 fn max_ordinal_present(&self) -> u64 {
1075 if let Some(_) = self.directories_fixup {
1076 return 10;
1077 }
1078 if let Some(_) = self.stopper {
1079 return 9;
1080 }
1081 if let Some(_) = self.namespace_entries {
1082 return 8;
1083 }
1084 if let Some(_) = self.env {
1085 return 7;
1086 }
1087 if let Some(_) = self.io_handles {
1088 return 4;
1089 }
1090 if let Some(_) = self.program {
1091 return 3;
1092 }
1093 if let Some(_) = self.args {
1094 return 2;
1095 }
1096 if let Some(_) = self.name {
1097 return 1;
1098 }
1099 0
1100 }
1101 }
1102
1103 impl fidl::encoding::ResourceTypeMarker for LaunchOptions {
1104 type Borrowed<'a> = &'a mut Self;
1105 fn take_or_borrow<'a>(
1106 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1107 ) -> Self::Borrowed<'a> {
1108 value
1109 }
1110 }
1111
1112 unsafe impl fidl::encoding::TypeMarker for LaunchOptions {
1113 type Owned = Self;
1114
1115 #[inline(always)]
1116 fn inline_align(_context: fidl::encoding::Context) -> usize {
1117 8
1118 }
1119
1120 #[inline(always)]
1121 fn inline_size(_context: fidl::encoding::Context) -> usize {
1122 16
1123 }
1124 }
1125
1126 unsafe impl fidl::encoding::Encode<LaunchOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
1127 for &mut LaunchOptions
1128 {
1129 unsafe fn encode(
1130 self,
1131 encoder: &mut fidl::encoding::Encoder<
1132 '_,
1133 fidl::encoding::DefaultFuchsiaResourceDialect,
1134 >,
1135 offset: usize,
1136 mut depth: fidl::encoding::Depth,
1137 ) -> fidl::Result<()> {
1138 encoder.debug_check_bounds::<LaunchOptions>(offset);
1139 let max_ordinal: u64 = self.max_ordinal_present();
1141 encoder.write_num(max_ordinal, offset);
1142 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1143 if max_ordinal == 0 {
1145 return Ok(());
1146 }
1147 depth.increment()?;
1148 let envelope_size = 8;
1149 let bytes_len = max_ordinal as usize * envelope_size;
1150 #[allow(unused_variables)]
1151 let offset = encoder.out_of_line_offset(bytes_len);
1152 let mut _prev_end_offset: usize = 0;
1153 if 1 > max_ordinal {
1154 return Ok(());
1155 }
1156
1157 let cur_offset: usize = (1 - 1) * envelope_size;
1160
1161 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1163
1164 fidl::encoding::encode_in_envelope_optional::<
1169 fidl::encoding::BoundedString<32>,
1170 fidl::encoding::DefaultFuchsiaResourceDialect,
1171 >(
1172 self.name.as_ref().map(
1173 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow,
1174 ),
1175 encoder,
1176 offset + cur_offset,
1177 depth,
1178 )?;
1179
1180 _prev_end_offset = cur_offset + envelope_size;
1181 if 2 > max_ordinal {
1182 return Ok(());
1183 }
1184
1185 let cur_offset: usize = (2 - 1) * envelope_size;
1188
1189 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1191
1192 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1197 self.args.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
1198 encoder, offset + cur_offset, depth
1199 )?;
1200
1201 _prev_end_offset = cur_offset + envelope_size;
1202 if 3 > max_ordinal {
1203 return Ok(());
1204 }
1205
1206 let cur_offset: usize = (3 - 1) * envelope_size;
1209
1210 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1212
1213 fidl::encoding::encode_in_envelope_optional::<
1218 Program,
1219 fidl::encoding::DefaultFuchsiaResourceDialect,
1220 >(
1221 self.program
1222 .as_mut()
1223 .map(<Program as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1224 encoder,
1225 offset + cur_offset,
1226 depth,
1227 )?;
1228
1229 _prev_end_offset = cur_offset + envelope_size;
1230 if 4 > max_ordinal {
1231 return Ok(());
1232 }
1233
1234 let cur_offset: usize = (4 - 1) * envelope_size;
1237
1238 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1240
1241 fidl::encoding::encode_in_envelope_optional::<
1246 IoHandles,
1247 fidl::encoding::DefaultFuchsiaResourceDialect,
1248 >(
1249 self.io_handles
1250 .as_mut()
1251 .map(<IoHandles as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1252 encoder,
1253 offset + cur_offset,
1254 depth,
1255 )?;
1256
1257 _prev_end_offset = cur_offset + envelope_size;
1258 if 7 > max_ordinal {
1259 return Ok(());
1260 }
1261
1262 let cur_offset: usize = (7 - 1) * envelope_size;
1265
1266 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1268
1269 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1274 self.env.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
1275 encoder, offset + cur_offset, depth
1276 )?;
1277
1278 _prev_end_offset = cur_offset + envelope_size;
1279 if 8 > max_ordinal {
1280 return Ok(());
1281 }
1282
1283 let cur_offset: usize = (8 - 1) * envelope_size;
1286
1287 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1289
1290 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_process::NameInfo>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1295 self.namespace_entries.as_mut().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_process::NameInfo> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1296 encoder, offset + cur_offset, depth
1297 )?;
1298
1299 _prev_end_offset = cur_offset + envelope_size;
1300 if 9 > max_ordinal {
1301 return Ok(());
1302 }
1303
1304 let cur_offset: usize = (9 - 1) * envelope_size;
1307
1308 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1310
1311 fidl::encoding::encode_in_envelope_optional::<
1316 fidl::encoding::HandleType<
1317 fidl::EventPair,
1318 { fidl::ObjectType::EVENTPAIR.into_raw() },
1319 2147483648,
1320 >,
1321 fidl::encoding::DefaultFuchsiaResourceDialect,
1322 >(
1323 self.stopper.as_mut().map(
1324 <fidl::encoding::HandleType<
1325 fidl::EventPair,
1326 { fidl::ObjectType::EVENTPAIR.into_raw() },
1327 2147483648,
1328 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1329 ),
1330 encoder,
1331 offset + cur_offset,
1332 depth,
1333 )?;
1334
1335 _prev_end_offset = cur_offset + envelope_size;
1336 if 10 > max_ordinal {
1337 return Ok(());
1338 }
1339
1340 let cur_offset: usize = (10 - 1) * envelope_size;
1343
1344 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1346
1347 fidl::encoding::encode_in_envelope_optional::<
1352 bool,
1353 fidl::encoding::DefaultFuchsiaResourceDialect,
1354 >(
1355 self.directories_fixup
1356 .as_ref()
1357 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1358 encoder,
1359 offset + cur_offset,
1360 depth,
1361 )?;
1362
1363 _prev_end_offset = cur_offset + envelope_size;
1364
1365 Ok(())
1366 }
1367 }
1368
1369 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for LaunchOptions {
1370 #[inline(always)]
1371 fn new_empty() -> Self {
1372 Self::default()
1373 }
1374
1375 unsafe fn decode(
1376 &mut self,
1377 decoder: &mut fidl::encoding::Decoder<
1378 '_,
1379 fidl::encoding::DefaultFuchsiaResourceDialect,
1380 >,
1381 offset: usize,
1382 mut depth: fidl::encoding::Depth,
1383 ) -> fidl::Result<()> {
1384 decoder.debug_check_bounds::<Self>(offset);
1385 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1386 None => return Err(fidl::Error::NotNullable),
1387 Some(len) => len,
1388 };
1389 if len == 0 {
1391 return Ok(());
1392 };
1393 depth.increment()?;
1394 let envelope_size = 8;
1395 let bytes_len = len * envelope_size;
1396 let offset = decoder.out_of_line_offset(bytes_len)?;
1397 let mut _next_ordinal_to_read = 0;
1399 let mut next_offset = offset;
1400 let end_offset = offset + bytes_len;
1401 _next_ordinal_to_read += 1;
1402 if next_offset >= end_offset {
1403 return Ok(());
1404 }
1405
1406 while _next_ordinal_to_read < 1 {
1408 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1409 _next_ordinal_to_read += 1;
1410 next_offset += envelope_size;
1411 }
1412
1413 let next_out_of_line = decoder.next_out_of_line();
1414 let handles_before = decoder.remaining_handles();
1415 if let Some((inlined, num_bytes, num_handles)) =
1416 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1417 {
1418 let member_inline_size =
1419 <fidl::encoding::BoundedString<32> as fidl::encoding::TypeMarker>::inline_size(
1420 decoder.context,
1421 );
1422 if inlined != (member_inline_size <= 4) {
1423 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1424 }
1425 let inner_offset;
1426 let mut inner_depth = depth.clone();
1427 if inlined {
1428 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1429 inner_offset = next_offset;
1430 } else {
1431 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1432 inner_depth.increment()?;
1433 }
1434 let val_ref = self.name.get_or_insert_with(|| {
1435 fidl::new_empty!(
1436 fidl::encoding::BoundedString<32>,
1437 fidl::encoding::DefaultFuchsiaResourceDialect
1438 )
1439 });
1440 fidl::decode!(
1441 fidl::encoding::BoundedString<32>,
1442 fidl::encoding::DefaultFuchsiaResourceDialect,
1443 val_ref,
1444 decoder,
1445 inner_offset,
1446 inner_depth
1447 )?;
1448 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1449 {
1450 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1451 }
1452 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1453 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1454 }
1455 }
1456
1457 next_offset += envelope_size;
1458 _next_ordinal_to_read += 1;
1459 if next_offset >= end_offset {
1460 return Ok(());
1461 }
1462
1463 while _next_ordinal_to_read < 2 {
1465 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1466 _next_ordinal_to_read += 1;
1467 next_offset += envelope_size;
1468 }
1469
1470 let next_out_of_line = decoder.next_out_of_line();
1471 let handles_before = decoder.remaining_handles();
1472 if let Some((inlined, num_bytes, num_handles)) =
1473 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1474 {
1475 let member_inline_size = <fidl::encoding::UnboundedVector<
1476 fidl::encoding::UnboundedString,
1477 > as fidl::encoding::TypeMarker>::inline_size(
1478 decoder.context
1479 );
1480 if inlined != (member_inline_size <= 4) {
1481 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1482 }
1483 let inner_offset;
1484 let mut inner_depth = depth.clone();
1485 if inlined {
1486 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1487 inner_offset = next_offset;
1488 } else {
1489 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1490 inner_depth.increment()?;
1491 }
1492 let val_ref = self.args.get_or_insert_with(|| {
1493 fidl::new_empty!(
1494 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1495 fidl::encoding::DefaultFuchsiaResourceDialect
1496 )
1497 });
1498 fidl::decode!(
1499 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1500 fidl::encoding::DefaultFuchsiaResourceDialect,
1501 val_ref,
1502 decoder,
1503 inner_offset,
1504 inner_depth
1505 )?;
1506 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1507 {
1508 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1509 }
1510 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1511 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1512 }
1513 }
1514
1515 next_offset += envelope_size;
1516 _next_ordinal_to_read += 1;
1517 if next_offset >= end_offset {
1518 return Ok(());
1519 }
1520
1521 while _next_ordinal_to_read < 3 {
1523 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1524 _next_ordinal_to_read += 1;
1525 next_offset += envelope_size;
1526 }
1527
1528 let next_out_of_line = decoder.next_out_of_line();
1529 let handles_before = decoder.remaining_handles();
1530 if let Some((inlined, num_bytes, num_handles)) =
1531 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1532 {
1533 let member_inline_size =
1534 <Program as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1535 if inlined != (member_inline_size <= 4) {
1536 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1537 }
1538 let inner_offset;
1539 let mut inner_depth = depth.clone();
1540 if inlined {
1541 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1542 inner_offset = next_offset;
1543 } else {
1544 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1545 inner_depth.increment()?;
1546 }
1547 let val_ref = self.program.get_or_insert_with(|| {
1548 fidl::new_empty!(Program, fidl::encoding::DefaultFuchsiaResourceDialect)
1549 });
1550 fidl::decode!(
1551 Program,
1552 fidl::encoding::DefaultFuchsiaResourceDialect,
1553 val_ref,
1554 decoder,
1555 inner_offset,
1556 inner_depth
1557 )?;
1558 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1559 {
1560 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1561 }
1562 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1563 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1564 }
1565 }
1566
1567 next_offset += envelope_size;
1568 _next_ordinal_to_read += 1;
1569 if next_offset >= end_offset {
1570 return Ok(());
1571 }
1572
1573 while _next_ordinal_to_read < 4 {
1575 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1576 _next_ordinal_to_read += 1;
1577 next_offset += envelope_size;
1578 }
1579
1580 let next_out_of_line = decoder.next_out_of_line();
1581 let handles_before = decoder.remaining_handles();
1582 if let Some((inlined, num_bytes, num_handles)) =
1583 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1584 {
1585 let member_inline_size =
1586 <IoHandles as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1587 if inlined != (member_inline_size <= 4) {
1588 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1589 }
1590 let inner_offset;
1591 let mut inner_depth = depth.clone();
1592 if inlined {
1593 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1594 inner_offset = next_offset;
1595 } else {
1596 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1597 inner_depth.increment()?;
1598 }
1599 let val_ref = self.io_handles.get_or_insert_with(|| {
1600 fidl::new_empty!(IoHandles, fidl::encoding::DefaultFuchsiaResourceDialect)
1601 });
1602 fidl::decode!(
1603 IoHandles,
1604 fidl::encoding::DefaultFuchsiaResourceDialect,
1605 val_ref,
1606 decoder,
1607 inner_offset,
1608 inner_depth
1609 )?;
1610 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1611 {
1612 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1613 }
1614 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1615 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1616 }
1617 }
1618
1619 next_offset += envelope_size;
1620 _next_ordinal_to_read += 1;
1621 if next_offset >= end_offset {
1622 return Ok(());
1623 }
1624
1625 while _next_ordinal_to_read < 7 {
1627 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1628 _next_ordinal_to_read += 1;
1629 next_offset += envelope_size;
1630 }
1631
1632 let next_out_of_line = decoder.next_out_of_line();
1633 let handles_before = decoder.remaining_handles();
1634 if let Some((inlined, num_bytes, num_handles)) =
1635 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1636 {
1637 let member_inline_size = <fidl::encoding::UnboundedVector<
1638 fidl::encoding::UnboundedString,
1639 > as fidl::encoding::TypeMarker>::inline_size(
1640 decoder.context
1641 );
1642 if inlined != (member_inline_size <= 4) {
1643 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1644 }
1645 let inner_offset;
1646 let mut inner_depth = depth.clone();
1647 if inlined {
1648 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1649 inner_offset = next_offset;
1650 } else {
1651 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1652 inner_depth.increment()?;
1653 }
1654 let val_ref = self.env.get_or_insert_with(|| {
1655 fidl::new_empty!(
1656 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1657 fidl::encoding::DefaultFuchsiaResourceDialect
1658 )
1659 });
1660 fidl::decode!(
1661 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1662 fidl::encoding::DefaultFuchsiaResourceDialect,
1663 val_ref,
1664 decoder,
1665 inner_offset,
1666 inner_depth
1667 )?;
1668 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1669 {
1670 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1671 }
1672 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1673 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1674 }
1675 }
1676
1677 next_offset += envelope_size;
1678 _next_ordinal_to_read += 1;
1679 if next_offset >= end_offset {
1680 return Ok(());
1681 }
1682
1683 while _next_ordinal_to_read < 8 {
1685 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1686 _next_ordinal_to_read += 1;
1687 next_offset += envelope_size;
1688 }
1689
1690 let next_out_of_line = decoder.next_out_of_line();
1691 let handles_before = decoder.remaining_handles();
1692 if let Some((inlined, num_bytes, num_handles)) =
1693 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1694 {
1695 let member_inline_size = <fidl::encoding::UnboundedVector<
1696 fidl_fuchsia_process::NameInfo,
1697 > as fidl::encoding::TypeMarker>::inline_size(
1698 decoder.context
1699 );
1700 if inlined != (member_inline_size <= 4) {
1701 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1702 }
1703 let inner_offset;
1704 let mut inner_depth = depth.clone();
1705 if inlined {
1706 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1707 inner_offset = next_offset;
1708 } else {
1709 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1710 inner_depth.increment()?;
1711 }
1712 let val_ref = self.namespace_entries.get_or_insert_with(|| {
1713 fidl::new_empty!(
1714 fidl::encoding::UnboundedVector<fidl_fuchsia_process::NameInfo>,
1715 fidl::encoding::DefaultFuchsiaResourceDialect
1716 )
1717 });
1718 fidl::decode!(
1719 fidl::encoding::UnboundedVector<fidl_fuchsia_process::NameInfo>,
1720 fidl::encoding::DefaultFuchsiaResourceDialect,
1721 val_ref,
1722 decoder,
1723 inner_offset,
1724 inner_depth
1725 )?;
1726 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1727 {
1728 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1729 }
1730 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1731 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1732 }
1733 }
1734
1735 next_offset += envelope_size;
1736 _next_ordinal_to_read += 1;
1737 if next_offset >= end_offset {
1738 return Ok(());
1739 }
1740
1741 while _next_ordinal_to_read < 9 {
1743 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1744 _next_ordinal_to_read += 1;
1745 next_offset += envelope_size;
1746 }
1747
1748 let next_out_of_line = decoder.next_out_of_line();
1749 let handles_before = decoder.remaining_handles();
1750 if let Some((inlined, num_bytes, num_handles)) =
1751 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1752 {
1753 let member_inline_size = <fidl::encoding::HandleType<
1754 fidl::EventPair,
1755 { fidl::ObjectType::EVENTPAIR.into_raw() },
1756 2147483648,
1757 > as fidl::encoding::TypeMarker>::inline_size(
1758 decoder.context
1759 );
1760 if inlined != (member_inline_size <= 4) {
1761 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1762 }
1763 let inner_offset;
1764 let mut inner_depth = depth.clone();
1765 if inlined {
1766 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1767 inner_offset = next_offset;
1768 } else {
1769 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1770 inner_depth.increment()?;
1771 }
1772 let val_ref =
1773 self.stopper.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1774 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1775 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1776 {
1777 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1778 }
1779 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1780 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1781 }
1782 }
1783
1784 next_offset += envelope_size;
1785 _next_ordinal_to_read += 1;
1786 if next_offset >= end_offset {
1787 return Ok(());
1788 }
1789
1790 while _next_ordinal_to_read < 10 {
1792 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1793 _next_ordinal_to_read += 1;
1794 next_offset += envelope_size;
1795 }
1796
1797 let next_out_of_line = decoder.next_out_of_line();
1798 let handles_before = decoder.remaining_handles();
1799 if let Some((inlined, num_bytes, num_handles)) =
1800 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1801 {
1802 let member_inline_size =
1803 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1804 if inlined != (member_inline_size <= 4) {
1805 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1806 }
1807 let inner_offset;
1808 let mut inner_depth = depth.clone();
1809 if inlined {
1810 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1811 inner_offset = next_offset;
1812 } else {
1813 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1814 inner_depth.increment()?;
1815 }
1816 let val_ref = self.directories_fixup.get_or_insert_with(|| {
1817 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
1818 });
1819 fidl::decode!(
1820 bool,
1821 fidl::encoding::DefaultFuchsiaResourceDialect,
1822 val_ref,
1823 decoder,
1824 inner_offset,
1825 inner_depth
1826 )?;
1827 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1828 {
1829 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1830 }
1831 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1832 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1833 }
1834 }
1835
1836 next_offset += envelope_size;
1837
1838 while next_offset < end_offset {
1840 _next_ordinal_to_read += 1;
1841 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1842 next_offset += envelope_size;
1843 }
1844
1845 Ok(())
1846 }
1847 }
1848
1849 impl fidl::encoding::ResourceTypeMarker for IoHandles {
1850 type Borrowed<'a> = &'a mut Self;
1851 fn take_or_borrow<'a>(
1852 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1853 ) -> Self::Borrowed<'a> {
1854 value
1855 }
1856 }
1857
1858 unsafe impl fidl::encoding::TypeMarker for IoHandles {
1859 type Owned = Self;
1860
1861 #[inline(always)]
1862 fn inline_align(_context: fidl::encoding::Context) -> usize {
1863 8
1864 }
1865
1866 #[inline(always)]
1867 fn inline_size(_context: fidl::encoding::Context) -> usize {
1868 16
1869 }
1870 }
1871
1872 unsafe impl fidl::encoding::Encode<IoHandles, fidl::encoding::DefaultFuchsiaResourceDialect>
1873 for &mut IoHandles
1874 {
1875 #[inline]
1876 unsafe fn encode(
1877 self,
1878 encoder: &mut fidl::encoding::Encoder<
1879 '_,
1880 fidl::encoding::DefaultFuchsiaResourceDialect,
1881 >,
1882 offset: usize,
1883 _depth: fidl::encoding::Depth,
1884 ) -> fidl::Result<()> {
1885 encoder.debug_check_bounds::<IoHandles>(offset);
1886 encoder.write_num::<u64>(self.ordinal(), offset);
1887 match self {
1888 IoHandles::RawHandles(ref mut val) => fidl::encoding::encode_in_envelope::<
1889 RawHandles,
1890 fidl::encoding::DefaultFuchsiaResourceDialect,
1891 >(
1892 <RawHandles as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
1893 encoder,
1894 offset + 8,
1895 _depth,
1896 ),
1897 IoHandles::PtySocket(ref mut val) => fidl::encoding::encode_in_envelope::<
1898 fidl::encoding::HandleType<
1899 fidl::Socket,
1900 { fidl::ObjectType::SOCKET.into_raw() },
1901 49167,
1902 >,
1903 fidl::encoding::DefaultFuchsiaResourceDialect,
1904 >(
1905 <fidl::encoding::HandleType<
1906 fidl::Socket,
1907 { fidl::ObjectType::SOCKET.into_raw() },
1908 49167,
1909 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1910 val
1911 ),
1912 encoder,
1913 offset + 8,
1914 _depth,
1915 ),
1916 IoHandles::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1917 }
1918 }
1919 }
1920
1921 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for IoHandles {
1922 #[inline(always)]
1923 fn new_empty() -> Self {
1924 Self::__SourceBreaking { unknown_ordinal: 0 }
1925 }
1926
1927 #[inline]
1928 unsafe fn decode(
1929 &mut self,
1930 decoder: &mut fidl::encoding::Decoder<
1931 '_,
1932 fidl::encoding::DefaultFuchsiaResourceDialect,
1933 >,
1934 offset: usize,
1935 mut depth: fidl::encoding::Depth,
1936 ) -> fidl::Result<()> {
1937 decoder.debug_check_bounds::<Self>(offset);
1938 #[allow(unused_variables)]
1939 let next_out_of_line = decoder.next_out_of_line();
1940 let handles_before = decoder.remaining_handles();
1941 let (ordinal, inlined, num_bytes, num_handles) =
1942 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1943
1944 let member_inline_size = match ordinal {
1945 1 => <RawHandles as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1946 2 => <fidl::encoding::HandleType<
1947 fidl::Socket,
1948 { fidl::ObjectType::SOCKET.into_raw() },
1949 49167,
1950 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1951 0 => return Err(fidl::Error::UnknownUnionTag),
1952 _ => num_bytes as usize,
1953 };
1954
1955 if inlined != (member_inline_size <= 4) {
1956 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1957 }
1958 let _inner_offset;
1959 if inlined {
1960 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1961 _inner_offset = offset + 8;
1962 } else {
1963 depth.increment()?;
1964 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1965 }
1966 match ordinal {
1967 1 => {
1968 #[allow(irrefutable_let_patterns)]
1969 if let IoHandles::RawHandles(_) = self {
1970 } else {
1972 *self = IoHandles::RawHandles(fidl::new_empty!(
1974 RawHandles,
1975 fidl::encoding::DefaultFuchsiaResourceDialect
1976 ));
1977 }
1978 #[allow(irrefutable_let_patterns)]
1979 if let IoHandles::RawHandles(ref mut val) = self {
1980 fidl::decode!(
1981 RawHandles,
1982 fidl::encoding::DefaultFuchsiaResourceDialect,
1983 val,
1984 decoder,
1985 _inner_offset,
1986 depth
1987 )?;
1988 } else {
1989 unreachable!()
1990 }
1991 }
1992 2 => {
1993 #[allow(irrefutable_let_patterns)]
1994 if let IoHandles::PtySocket(_) = self {
1995 } else {
1997 *self = IoHandles::PtySocket(
1999 fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 49167>, fidl::encoding::DefaultFuchsiaResourceDialect),
2000 );
2001 }
2002 #[allow(irrefutable_let_patterns)]
2003 if let IoHandles::PtySocket(ref mut val) = self {
2004 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 49167>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
2005 } else {
2006 unreachable!()
2007 }
2008 }
2009 #[allow(deprecated)]
2010 ordinal => {
2011 for _ in 0..num_handles {
2012 decoder.drop_next_handle()?;
2013 }
2014 *self = IoHandles::__SourceBreaking { unknown_ordinal: ordinal };
2015 }
2016 }
2017 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2018 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2019 }
2020 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2021 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2022 }
2023 Ok(())
2024 }
2025 }
2026
2027 impl fidl::encoding::ResourceTypeMarker for Program {
2028 type Borrowed<'a> = &'a mut Self;
2029 fn take_or_borrow<'a>(
2030 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2031 ) -> Self::Borrowed<'a> {
2032 value
2033 }
2034 }
2035
2036 unsafe impl fidl::encoding::TypeMarker for Program {
2037 type Owned = Self;
2038
2039 #[inline(always)]
2040 fn inline_align(_context: fidl::encoding::Context) -> usize {
2041 8
2042 }
2043
2044 #[inline(always)]
2045 fn inline_size(_context: fidl::encoding::Context) -> usize {
2046 16
2047 }
2048 }
2049
2050 unsafe impl fidl::encoding::Encode<Program, fidl::encoding::DefaultFuchsiaResourceDialect>
2051 for &mut Program
2052 {
2053 #[inline]
2054 unsafe fn encode(
2055 self,
2056 encoder: &mut fidl::encoding::Encoder<
2057 '_,
2058 fidl::encoding::DefaultFuchsiaResourceDialect,
2059 >,
2060 offset: usize,
2061 _depth: fidl::encoding::Depth,
2062 ) -> fidl::Result<()> {
2063 encoder.debug_check_bounds::<Program>(offset);
2064 encoder.write_num::<u64>(self.ordinal(), offset);
2065 match self {
2066 Program::DefaultShell(ref val) => fidl::encoding::encode_in_envelope::<
2067 Empty,
2068 fidl::encoding::DefaultFuchsiaResourceDialect,
2069 >(
2070 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2071 encoder,
2072 offset + 8,
2073 _depth,
2074 ),
2075 Program::FromPackage(ref mut val) => fidl::encoding::encode_in_envelope::<
2076 PackageProgram,
2077 fidl::encoding::DefaultFuchsiaResourceDialect,
2078 >(
2079 <PackageProgram as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2080 encoder,
2081 offset + 8,
2082 _depth,
2083 ),
2084 Program::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2085 }
2086 }
2087 }
2088
2089 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Program {
2090 #[inline(always)]
2091 fn new_empty() -> Self {
2092 Self::__SourceBreaking { unknown_ordinal: 0 }
2093 }
2094
2095 #[inline]
2096 unsafe fn decode(
2097 &mut self,
2098 decoder: &mut fidl::encoding::Decoder<
2099 '_,
2100 fidl::encoding::DefaultFuchsiaResourceDialect,
2101 >,
2102 offset: usize,
2103 mut depth: fidl::encoding::Depth,
2104 ) -> fidl::Result<()> {
2105 decoder.debug_check_bounds::<Self>(offset);
2106 #[allow(unused_variables)]
2107 let next_out_of_line = decoder.next_out_of_line();
2108 let handles_before = decoder.remaining_handles();
2109 let (ordinal, inlined, num_bytes, num_handles) =
2110 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2111
2112 let member_inline_size = match ordinal {
2113 1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2114 2 => <PackageProgram as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2115 0 => return Err(fidl::Error::UnknownUnionTag),
2116 _ => num_bytes as usize,
2117 };
2118
2119 if inlined != (member_inline_size <= 4) {
2120 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2121 }
2122 let _inner_offset;
2123 if inlined {
2124 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2125 _inner_offset = offset + 8;
2126 } else {
2127 depth.increment()?;
2128 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2129 }
2130 match ordinal {
2131 1 => {
2132 #[allow(irrefutable_let_patterns)]
2133 if let Program::DefaultShell(_) = self {
2134 } else {
2136 *self = Program::DefaultShell(fidl::new_empty!(
2138 Empty,
2139 fidl::encoding::DefaultFuchsiaResourceDialect
2140 ));
2141 }
2142 #[allow(irrefutable_let_patterns)]
2143 if let Program::DefaultShell(ref mut val) = self {
2144 fidl::decode!(
2145 Empty,
2146 fidl::encoding::DefaultFuchsiaResourceDialect,
2147 val,
2148 decoder,
2149 _inner_offset,
2150 depth
2151 )?;
2152 } else {
2153 unreachable!()
2154 }
2155 }
2156 2 => {
2157 #[allow(irrefutable_let_patterns)]
2158 if let Program::FromPackage(_) = self {
2159 } else {
2161 *self = Program::FromPackage(fidl::new_empty!(
2163 PackageProgram,
2164 fidl::encoding::DefaultFuchsiaResourceDialect
2165 ));
2166 }
2167 #[allow(irrefutable_let_patterns)]
2168 if let Program::FromPackage(ref mut val) = self {
2169 fidl::decode!(
2170 PackageProgram,
2171 fidl::encoding::DefaultFuchsiaResourceDialect,
2172 val,
2173 decoder,
2174 _inner_offset,
2175 depth
2176 )?;
2177 } else {
2178 unreachable!()
2179 }
2180 }
2181 #[allow(deprecated)]
2182 ordinal => {
2183 for _ in 0..num_handles {
2184 decoder.drop_next_handle()?;
2185 }
2186 *self = Program::__SourceBreaking { unknown_ordinal: ordinal };
2187 }
2188 }
2189 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2190 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2191 }
2192 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2193 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2194 }
2195 Ok(())
2196 }
2197 }
2198}