Skip to main content

fidl_fuchsia_component_runner/
fidl_fuchsia_component_runner.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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_component_runner__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ComponentControllerOnPublishDiagnosticsRequest {
16    pub payload: ComponentDiagnostics,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for ComponentControllerOnPublishDiagnosticsRequest
21{
22}
23
24#[derive(Debug, PartialEq)]
25pub struct ComponentRunnerStartRequest {
26    pub start_info: ComponentStartInfo,
27    pub controller: fidl::endpoints::ServerEnd<ComponentControllerMarker>,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31    for ComponentRunnerStartRequest
32{
33}
34
35#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36pub struct TaskProviderGetJobResponse {
37    pub job: fidl::Job,
38}
39
40impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
41    for TaskProviderGetJobResponse
42{
43}
44
45#[derive(Debug, Default, PartialEq)]
46pub struct ComponentControllerOnEscrowRequest {
47    /// Escrow the outgoing directory server endpoint. Whenever the
48    /// component is started, the framework will return this channel via
49    /// [`ComponentStartInfo.outgoing_dir`].
50    pub outgoing_dir: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
51    /// Escrow some user defined state. Whenever the component is started,
52    /// the framework will return these handles via
53    /// [`ComponentStartInfo.escrowed_dictionary`].
54    ///
55    /// The framework will not wait for any signals on these objects.
56    ///
57    /// ## Example
58    ///
59    /// Let's say a component needs to escrow an event pair that represents
60    /// the result of some expensive calculation. It can create a
61    /// dictionary, put the event pair inside with an appropriate key
62    /// (e.g. `"my_event_pair"`), then check for that entry on startup.
63    /// Note that this is deprecated, please use
64    /// `escrowed_dictionary_handle` instead.
65    pub escrowed_dictionary: Option<fidl_fuchsia_component_sandbox::DictionaryRef>,
66    /// Escrow some user defined state. Whenever the component is started,
67    /// the framework will return these handles via
68    /// [`ComponentStartInfo.escrowed_dictionary`].
69    ///
70    /// The framework will not wait for any signals on these objects.
71    ///
72    /// ## Example
73    ///
74    /// Let's say a component needs to escrow an event pair that represents
75    /// the result of some expensive calculation. It can create a
76    /// dictionary, put the event pair inside with an appropriate key
77    /// (e.g. `"my_event_pair"`), then check for that entry on startup.
78    pub escrowed_dictionary_handle: Option<fidl::EventPair>,
79    #[doc(hidden)]
80    pub __source_breaking: fidl::marker::SourceBreaking,
81}
82
83impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
84    for ComponentControllerOnEscrowRequest
85{
86}
87
88#[derive(Debug, Default, PartialEq)]
89pub struct ComponentDiagnostics {
90    pub tasks: Option<ComponentTasks>,
91    #[doc(hidden)]
92    pub __source_breaking: fidl::marker::SourceBreaking,
93}
94
95impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ComponentDiagnostics {}
96
97/// A single component namespace entry, which describes a namespace mount point
98/// (`path`) and the directory backing it (`directory`). This type is usually
99/// composed inside a vector.  See `ComponentStartInfo.ns` for more details.
100#[derive(Debug, Default, PartialEq)]
101pub struct ComponentNamespaceEntry {
102    /// The mount point for the directory, including a
103    /// leading slash. For example: "/pkg", "/svc", or "/config/data".
104    pub path: Option<String>,
105    /// The directory mounted at the above `path`.
106    pub directory: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
107    #[doc(hidden)]
108    pub __source_breaking: fidl::marker::SourceBreaking,
109}
110
111impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ComponentNamespaceEntry {}
112
113/// Parameters for starting a new component instance.
114#[derive(Debug, Default, PartialEq)]
115pub struct ComponentStartInfo {
116    /// The URL of the component. Called `resolved_url` instead of just `url`
117    /// for historical reasons.
118    pub resolved_url: Option<String>,
119    /// The component's program declaration.
120    /// This information originates from `ComponentDecl.program`.
121    pub program: Option<fidl_fuchsia_data::Dictionary>,
122    /// The namespace to provide to the component instance.
123    ///
124    /// A namespace specifies the set of directories that a component instance
125    /// receives at start-up. Through the namespace directories, a component
126    /// may access capabilities available to it. The contents of the namespace
127    /// are mainly determined by the component's `use` declarations but may
128    /// also contain additional capabilities automatically provided by the
129    /// framework.
130    ///
131    /// By convention, a component's namespace typically contains some or all
132    /// of the following directories:
133    ///
134    /// - "/svc": A directory containing services that the component requested
135    ///           to use via its "import" declarations.
136    /// - "/pkg": A directory containing the component's package, including its
137    ///           binaries, libraries, and other assets.
138    ///
139    /// The mount points specified in each entry must be unique and
140    /// non-overlapping. For example, [{"/foo", ..}, {"/foo/bar", ..}] is
141    /// invalid.
142    pub ns: Option<Vec<ComponentNamespaceEntry>>,
143    /// The directory this component serves.
144    pub outgoing_dir: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
145    /// The directory served by the runner to present runtime information about
146    /// the component. The runner must either serve it, or drop it to avoid
147    /// blocking any consumers indefinitely.
148    pub runtime_dir: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
149    /// The numbered handles that were passed to the component.
150    ///
151    /// If the component does not support numbered handles, the runner is expected
152    /// to close the handles.
153    pub numbered_handles: Option<Vec<fidl_fuchsia_process::HandleInfo>>,
154    /// Binary representation of the component's configuration.
155    ///
156    /// # Layout
157    ///
158    /// The first 2 bytes of the data should be interpreted as an unsigned 16-bit
159    /// little-endian integer which denotes the number of bytes following it that
160    /// contain the configuration checksum. After the checksum, all the remaining
161    /// bytes are a persistent FIDL message of a top-level struct. The struct's
162    /// fields match the configuration fields of the component's compiled manifest
163    /// in the same order.
164    pub encoded_config: Option<fidl_fuchsia_mem::Data>,
165    /// An eventpair that debuggers can use to defer the launch of the component.
166    ///
167    /// For example, ELF runners hold off from creating processes in the component
168    /// until ZX_EVENTPAIR_PEER_CLOSED is signaled on this eventpair. They also
169    /// ensure that runtime_dir is served before waiting on this eventpair.
170    /// ELF debuggers can query the runtime_dir to decide whether to attach before
171    /// they drop the other side of the eventpair, which is sent in the payload of
172    /// the DebugStarted event in fuchsia.component.events.
173    pub break_on_start: Option<fidl::EventPair>,
174    /// An opaque token that represents the component instance.
175    ///
176    /// The `fuchsia.component/Introspector` protocol may be used to get the
177    /// string moniker of the instance from this token.
178    ///
179    /// Runners may publish this token as part of diagnostics information, to
180    /// identify the running component without knowing its moniker.
181    ///
182    /// The token is invalidated when the component instance is destroyed.
183    pub component_instance: Option<fidl::Event>,
184    /// A dictionary containing data and handles that the component has escrowed
185    /// during its previous execution via [`ComponentController.OnEscrow`]. Note
186    /// that this field is considered deprecated, please use
187    /// `escrowed_dictionary_handle` instead.
188    pub escrowed_dictionary: Option<fidl_fuchsia_component_sandbox::DictionaryRef>,
189    /// A dictionary containing data and handles that the component has escrowed
190    /// during its previous execution via [`ComponentController.OnEscrow`].
191    pub escrowed_dictionary_handle: Option<fidl::EventPair>,
192    #[doc(hidden)]
193    pub __source_breaking: fidl::marker::SourceBreaking,
194}
195
196impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ComponentStartInfo {}
197
198#[derive(Debug, Default, PartialEq)]
199pub struct ComponentStopInfo {
200    /// The component's termination status, as documented on [ComponentRunner] above.
201    ///
202    /// The caller should set this field. If it is absent, the framework will assume
203    /// a value of ZX_OK.
204    pub termination_status: Option<i32>,
205    /// (Optional) The exit code of the component instance.
206    ///
207    /// Runner implementors may map their runtime specific exit code concept
208    /// (such as libc exit status) to this field. Or they may choose to
209    /// leave this blank.
210    pub exit_code: Option<i64>,
211    #[doc(hidden)]
212    pub __source_breaking: fidl::marker::SourceBreaking,
213}
214
215impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ComponentStopInfo {}
216
217#[derive(Debug, Default, PartialEq)]
218pub struct ComponentTasks {
219    pub component_task: Option<Task>,
220    pub parent_task: Option<Task>,
221    #[doc(hidden)]
222    pub __source_breaking: fidl::marker::SourceBreaking,
223}
224
225impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ComponentTasks {}
226
227#[derive(Debug)]
228pub enum Task {
229    Job(fidl::Job),
230    Process(fidl::Process),
231    Thread(fidl::Thread),
232    #[doc(hidden)]
233    __SourceBreaking {
234        unknown_ordinal: u64,
235    },
236}
237
238/// Pattern that matches an unknown `Task` member.
239#[macro_export]
240macro_rules! TaskUnknown {
241    () => {
242        _
243    };
244}
245
246// Custom PartialEq so that unknown variants are not equal to themselves.
247impl PartialEq for Task {
248    fn eq(&self, other: &Self) -> bool {
249        match (self, other) {
250            (Self::Job(x), Self::Job(y)) => *x == *y,
251            (Self::Process(x), Self::Process(y)) => *x == *y,
252            (Self::Thread(x), Self::Thread(y)) => *x == *y,
253            _ => false,
254        }
255    }
256}
257
258impl Task {
259    #[inline]
260    pub fn ordinal(&self) -> u64 {
261        match *self {
262            Self::Job(_) => 1,
263            Self::Process(_) => 2,
264            Self::Thread(_) => 3,
265            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
266        }
267    }
268
269    #[inline]
270    pub fn unknown_variant_for_testing() -> Self {
271        Self::__SourceBreaking { unknown_ordinal: 0 }
272    }
273
274    #[inline]
275    pub fn is_unknown(&self) -> bool {
276        match self {
277            Self::__SourceBreaking { .. } => true,
278            _ => false,
279        }
280    }
281}
282
283impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Task {}
284
285#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
286pub struct ComponentControllerMarker;
287
288impl fidl::endpoints::ProtocolMarker for ComponentControllerMarker {
289    type Proxy = ComponentControllerProxy;
290    type RequestStream = ComponentControllerRequestStream;
291    #[cfg(target_os = "fuchsia")]
292    type SynchronousProxy = ComponentControllerSynchronousProxy;
293
294    const DEBUG_NAME: &'static str = "(anonymous) ComponentController";
295}
296
297pub trait ComponentControllerProxyInterface: Send + Sync {
298    fn r#stop(&self) -> Result<(), fidl::Error>;
299    fn r#kill(&self) -> Result<(), fidl::Error>;
300}
301#[derive(Debug)]
302#[cfg(target_os = "fuchsia")]
303pub struct ComponentControllerSynchronousProxy {
304    client: fidl::client::sync::Client,
305}
306
307#[cfg(target_os = "fuchsia")]
308impl fidl::endpoints::SynchronousProxy for ComponentControllerSynchronousProxy {
309    type Proxy = ComponentControllerProxy;
310    type Protocol = ComponentControllerMarker;
311
312    fn from_channel(inner: fidl::Channel) -> Self {
313        Self::new(inner)
314    }
315
316    fn into_channel(self) -> fidl::Channel {
317        self.client.into_channel()
318    }
319
320    fn as_channel(&self) -> &fidl::Channel {
321        self.client.as_channel()
322    }
323}
324
325#[cfg(target_os = "fuchsia")]
326impl ComponentControllerSynchronousProxy {
327    pub fn new(channel: fidl::Channel) -> Self {
328        Self { client: fidl::client::sync::Client::new(channel) }
329    }
330
331    pub fn into_channel(self) -> fidl::Channel {
332        self.client.into_channel()
333    }
334
335    /// Waits until an event arrives and returns it. It is safe for other
336    /// threads to make concurrent requests while waiting for an event.
337    pub fn wait_for_event(
338        &self,
339        deadline: zx::MonotonicInstant,
340    ) -> Result<ComponentControllerEvent, fidl::Error> {
341        ComponentControllerEvent::decode(
342            self.client.wait_for_event::<ComponentControllerMarker>(deadline)?,
343        )
344    }
345
346    /// Request to stop the component instance.
347    ///
348    /// After stopping the component instance, the server should close this
349    /// connection with an epitaph. After the connection
350    /// closes, component manager considers this component instance to be
351    /// Stopped and the component's namespace will be torn down.
352    pub fn r#stop(&self) -> Result<(), fidl::Error> {
353        self.client.send::<fidl::encoding::EmptyPayload>(
354            (),
355            0x42ad097fa07c1b62,
356            fidl::encoding::DynamicFlags::empty(),
357        )
358    }
359
360    /// Stop this component instance immediately.
361    ///
362    /// The ComponentRunner must immediately kill the component instance, and
363    /// then close this connection with an epitaph. After the connection
364    /// closes, component manager considers this component instance to be
365    /// Stopped and the component's namespace will be torn down.
366    ///
367    /// In some cases Kill() may be issued before Stop(), but that is not
368    /// guaranteed.
369    pub fn r#kill(&self) -> Result<(), fidl::Error> {
370        self.client.send::<fidl::encoding::EmptyPayload>(
371            (),
372            0x3ea62e200a45aeb4,
373            fidl::encoding::DynamicFlags::empty(),
374        )
375    }
376}
377
378#[cfg(target_os = "fuchsia")]
379impl From<ComponentControllerSynchronousProxy> for zx::NullableHandle {
380    fn from(value: ComponentControllerSynchronousProxy) -> Self {
381        value.into_channel().into()
382    }
383}
384
385#[cfg(target_os = "fuchsia")]
386impl From<fidl::Channel> for ComponentControllerSynchronousProxy {
387    fn from(value: fidl::Channel) -> Self {
388        Self::new(value)
389    }
390}
391
392#[cfg(target_os = "fuchsia")]
393impl fidl::endpoints::FromClient for ComponentControllerSynchronousProxy {
394    type Protocol = ComponentControllerMarker;
395
396    fn from_client(value: fidl::endpoints::ClientEnd<ComponentControllerMarker>) -> Self {
397        Self::new(value.into_channel())
398    }
399}
400
401#[derive(Debug, Clone)]
402pub struct ComponentControllerProxy {
403    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
404}
405
406impl fidl::endpoints::Proxy for ComponentControllerProxy {
407    type Protocol = ComponentControllerMarker;
408
409    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
410        Self::new(inner)
411    }
412
413    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
414        self.client.into_channel().map_err(|client| Self { client })
415    }
416
417    fn as_channel(&self) -> &::fidl::AsyncChannel {
418        self.client.as_channel()
419    }
420}
421
422impl ComponentControllerProxy {
423    /// Create a new Proxy for fuchsia.component.runner/ComponentController.
424    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
425        let protocol_name =
426            <ComponentControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
427        Self { client: fidl::client::Client::new(channel, protocol_name) }
428    }
429
430    /// Get a Stream of events from the remote end of the protocol.
431    ///
432    /// # Panics
433    ///
434    /// Panics if the event stream was already taken.
435    pub fn take_event_stream(&self) -> ComponentControllerEventStream {
436        ComponentControllerEventStream { event_receiver: self.client.take_event_receiver() }
437    }
438
439    /// Request to stop the component instance.
440    ///
441    /// After stopping the component instance, the server should close this
442    /// connection with an epitaph. After the connection
443    /// closes, component manager considers this component instance to be
444    /// Stopped and the component's namespace will be torn down.
445    pub fn r#stop(&self) -> Result<(), fidl::Error> {
446        ComponentControllerProxyInterface::r#stop(self)
447    }
448
449    /// Stop this component instance immediately.
450    ///
451    /// The ComponentRunner must immediately kill the component instance, and
452    /// then close this connection with an epitaph. After the connection
453    /// closes, component manager considers this component instance to be
454    /// Stopped and the component's namespace will be torn down.
455    ///
456    /// In some cases Kill() may be issued before Stop(), but that is not
457    /// guaranteed.
458    pub fn r#kill(&self) -> Result<(), fidl::Error> {
459        ComponentControllerProxyInterface::r#kill(self)
460    }
461}
462
463impl ComponentControllerProxyInterface for ComponentControllerProxy {
464    fn r#stop(&self) -> Result<(), fidl::Error> {
465        self.client.send::<fidl::encoding::EmptyPayload>(
466            (),
467            0x42ad097fa07c1b62,
468            fidl::encoding::DynamicFlags::empty(),
469        )
470    }
471
472    fn r#kill(&self) -> Result<(), fidl::Error> {
473        self.client.send::<fidl::encoding::EmptyPayload>(
474            (),
475            0x3ea62e200a45aeb4,
476            fidl::encoding::DynamicFlags::empty(),
477        )
478    }
479}
480
481pub struct ComponentControllerEventStream {
482    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
483}
484
485impl std::marker::Unpin for ComponentControllerEventStream {}
486
487impl futures::stream::FusedStream for ComponentControllerEventStream {
488    fn is_terminated(&self) -> bool {
489        self.event_receiver.is_terminated()
490    }
491}
492
493impl futures::Stream for ComponentControllerEventStream {
494    type Item = Result<ComponentControllerEvent, fidl::Error>;
495
496    fn poll_next(
497        mut self: std::pin::Pin<&mut Self>,
498        cx: &mut std::task::Context<'_>,
499    ) -> std::task::Poll<Option<Self::Item>> {
500        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
501            &mut self.event_receiver,
502            cx
503        )?) {
504            Some(buf) => std::task::Poll::Ready(Some(ComponentControllerEvent::decode(buf))),
505            None => std::task::Poll::Ready(None),
506        }
507    }
508}
509
510#[derive(Debug)]
511pub enum ComponentControllerEvent {
512    OnPublishDiagnostics {
513        payload: ComponentDiagnostics,
514    },
515    OnEscrow {
516        payload: ComponentControllerOnEscrowRequest,
517    },
518    OnStop {
519        payload: ComponentStopInfo,
520    },
521    #[non_exhaustive]
522    _UnknownEvent {
523        /// Ordinal of the event that was sent.
524        ordinal: u64,
525    },
526}
527
528impl ComponentControllerEvent {
529    #[allow(irrefutable_let_patterns)]
530    pub fn into_on_publish_diagnostics(self) -> Option<ComponentDiagnostics> {
531        if let ComponentControllerEvent::OnPublishDiagnostics { payload } = self {
532            Some((payload))
533        } else {
534            None
535        }
536    }
537    #[allow(irrefutable_let_patterns)]
538    pub fn into_on_escrow(self) -> Option<ComponentControllerOnEscrowRequest> {
539        if let ComponentControllerEvent::OnEscrow { payload } = self {
540            Some((payload))
541        } else {
542            None
543        }
544    }
545    #[allow(irrefutable_let_patterns)]
546    pub fn into_on_stop(self) -> Option<ComponentStopInfo> {
547        if let ComponentControllerEvent::OnStop { payload } = self { Some((payload)) } else { None }
548    }
549
550    /// Decodes a message buffer as a [`ComponentControllerEvent`].
551    fn decode(
552        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
553    ) -> Result<ComponentControllerEvent, fidl::Error> {
554        let (bytes, _handles) = buf.split_mut();
555        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
556        debug_assert_eq!(tx_header.tx_id, 0);
557        match tx_header.ordinal {
558            0x1f16d8c3c49c6947 => {
559                let mut out = fidl::new_empty!(
560                    ComponentControllerOnPublishDiagnosticsRequest,
561                    fidl::encoding::DefaultFuchsiaResourceDialect
562                );
563                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ComponentControllerOnPublishDiagnosticsRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
564                Ok((ComponentControllerEvent::OnPublishDiagnostics { payload: out.payload }))
565            }
566            0xa231349355343fc => {
567                let mut out = fidl::new_empty!(
568                    ComponentControllerOnEscrowRequest,
569                    fidl::encoding::DefaultFuchsiaResourceDialect
570                );
571                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ComponentControllerOnEscrowRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
572                Ok((ComponentControllerEvent::OnEscrow { payload: out }))
573            }
574            0x3bfd24b031878ab2 => {
575                let mut out = fidl::new_empty!(
576                    ComponentStopInfo,
577                    fidl::encoding::DefaultFuchsiaResourceDialect
578                );
579                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ComponentStopInfo>(&tx_header, _body_bytes, _handles, &mut out)?;
580                Ok((ComponentControllerEvent::OnStop { payload: out }))
581            }
582            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
583                Ok(ComponentControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
584            }
585            _ => Err(fidl::Error::UnknownOrdinal {
586                ordinal: tx_header.ordinal,
587                protocol_name:
588                    <ComponentControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
589            }),
590        }
591    }
592}
593
594/// A Stream of incoming requests for fuchsia.component.runner/ComponentController.
595pub struct ComponentControllerRequestStream {
596    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
597    is_terminated: bool,
598}
599
600impl std::marker::Unpin for ComponentControllerRequestStream {}
601
602impl futures::stream::FusedStream for ComponentControllerRequestStream {
603    fn is_terminated(&self) -> bool {
604        self.is_terminated
605    }
606}
607
608impl fidl::endpoints::RequestStream for ComponentControllerRequestStream {
609    type Protocol = ComponentControllerMarker;
610    type ControlHandle = ComponentControllerControlHandle;
611
612    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
613        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
614    }
615
616    fn control_handle(&self) -> Self::ControlHandle {
617        ComponentControllerControlHandle { inner: self.inner.clone() }
618    }
619
620    fn into_inner(
621        self,
622    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
623    {
624        (self.inner, self.is_terminated)
625    }
626
627    fn from_inner(
628        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
629        is_terminated: bool,
630    ) -> Self {
631        Self { inner, is_terminated }
632    }
633}
634
635impl futures::Stream for ComponentControllerRequestStream {
636    type Item = Result<ComponentControllerRequest, fidl::Error>;
637
638    fn poll_next(
639        mut self: std::pin::Pin<&mut Self>,
640        cx: &mut std::task::Context<'_>,
641    ) -> std::task::Poll<Option<Self::Item>> {
642        let this = &mut *self;
643        if this.inner.check_shutdown(cx) {
644            this.is_terminated = true;
645            return std::task::Poll::Ready(None);
646        }
647        if this.is_terminated {
648            panic!("polled ComponentControllerRequestStream after completion");
649        }
650        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
651            |bytes, handles| {
652                match this.inner.channel().read_etc(cx, bytes, handles) {
653                    std::task::Poll::Ready(Ok(())) => {}
654                    std::task::Poll::Pending => return std::task::Poll::Pending,
655                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
656                        this.is_terminated = true;
657                        return std::task::Poll::Ready(None);
658                    }
659                    std::task::Poll::Ready(Err(e)) => {
660                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
661                            e.into(),
662                        ))));
663                    }
664                }
665
666                // A message has been received from the channel
667                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
668
669                std::task::Poll::Ready(Some(match header.ordinal {
670                0x42ad097fa07c1b62 => {
671                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
672                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
673                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
674                    let control_handle = ComponentControllerControlHandle {
675                        inner: this.inner.clone(),
676                    };
677                    Ok(ComponentControllerRequest::Stop {
678                        control_handle,
679                    })
680                }
681                0x3ea62e200a45aeb4 => {
682                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
683                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
684                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
685                    let control_handle = ComponentControllerControlHandle {
686                        inner: this.inner.clone(),
687                    };
688                    Ok(ComponentControllerRequest::Kill {
689                        control_handle,
690                    })
691                }
692                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
693                    Ok(ComponentControllerRequest::_UnknownMethod {
694                        ordinal: header.ordinal,
695                        control_handle: ComponentControllerControlHandle { inner: this.inner.clone() },
696                        method_type: fidl::MethodType::OneWay,
697                    })
698                }
699                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
700                    this.inner.send_framework_err(
701                        fidl::encoding::FrameworkErr::UnknownMethod,
702                        header.tx_id,
703                        header.ordinal,
704                        header.dynamic_flags(),
705                        (bytes, handles),
706                    )?;
707                    Ok(ComponentControllerRequest::_UnknownMethod {
708                        ordinal: header.ordinal,
709                        control_handle: ComponentControllerControlHandle { inner: this.inner.clone() },
710                        method_type: fidl::MethodType::TwoWay,
711                    })
712                }
713                _ => Err(fidl::Error::UnknownOrdinal {
714                    ordinal: header.ordinal,
715                    protocol_name: <ComponentControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
716                }),
717            }))
718            },
719        )
720    }
721}
722
723/// A protocol for binding and controlling the lifetime of a component instance
724/// started using `ComponentRunner.Start()`. The component manager is the
725/// intended direct client of this protocol.
726///
727/// When the controlled component instance terminates or becomes inaccessible
728/// for any reason, the server closes the connection with an epitaph.
729///
730/// # Lifecycle
731///
732/// A component may exist in one of two states: `Started`, or `Stopped`. The
733/// component is `Started` from the time `ComponentRunner.Start()` is called
734/// until the ComponentRunner closes the ComponentController handle. The
735/// component then transitions to `Stopped`.
736///
737/// Component manager uses ComponentController to terminate a component in two
738/// steps:
739///
740/// 1.  Component manager calls `Stop()` to indicate that the ComponentRunner
741///     should stop a component's execution and send the `OnStop` event.
742/// 2.  If after some time the ComponentController is not closed, component
743///     manager calls `Kill()` to indicate that the ComponentRunner must halt a
744///     component's execution immediately, and then send the `OnStop` event.
745///     The component manager may wait some period of time after calling `Kill()`
746///     before sending `OnStop`, but makes no guarantees it will wait or for how long.
747///
748/// Component manager first waits for the ComponentController to close, and
749/// then tears down the namespace it hosts for the stopped component. Component
750/// manager may call `Kill()` without first having called `Stop()`.
751///
752/// Before stopping, a component can optionally use `OnEscrow` to store some
753/// state in the framework, to receive those state again the next time it is
754/// started.
755///
756/// When the component stops, the runner should send an `OnStop` event
757/// instead of just closing the channel, to report the component's termination status
758/// (see below) and (optionally) an exit code. Once the runner has sent `OnStop`
759/// it is free to close [ComponentRunner]; the component framework will close
760/// its end of the channel when it receives this event.
761///
762/// ## Legacy
763///
764/// Instead of sending `OnStop`, it is also legal for a runner to close the channel
765/// with with an epitaph equal to the termination status, but this is a legacy method
766/// for backward compatibility that's no longer recommended.
767///
768/// # Termination status
769///
770/// The termination status indicates the component's final disposition in the eyes of
771/// the runner.
772///
773/// Note that termination status is _not_ synonymous with a component's exit code.
774/// A component's exit code, which is optional for a runner to report, is an
775/// integer that represents the program's own return code. For example, for ELF
776/// components, it is the value returned by main(). The termination status is
777/// the _runner_'s status code for the component's termination, which may capture
778/// failure modes that occur in the context of the runner itself rather than the
779/// program.
780///
781/// The following termination statuses may be sent by the server on error:
782///
783/// - `ZX_OK`: The component exited successfully, typically because the
784///   component was asked to stop or it decided independently to exit.
785/// - `INVALID_ARGUMENTS`:
786///     * `start_info.resolved_url` is not supported by this
787///       runner;
788///     * `start_info` contains missing or invalid arguments.
789/// - `INSTANCE_CANNOT_START`: The runner could not start the component.
790///   For example, a critical part of the program could not be found or
791///   loaded, or the referenced binary was invalid for this runner.
792/// - `RESOURCE_UNAVAILABLE`: The component could not be launched due to
793///   lack of resources.
794/// - `INTERNAL`: An unexpected internal runner error was encountered.
795/// - `INSTANCE_DIED`: The component instance was started but
796///   subsequently terminated with an error.
797/// - Other status codes (e.g. `ZX_ERR_PEER_CLOSED`) may indicate a failure
798///   of the component runner itself. The component manager may respond to such
799///   failures by terminating the component runner's job to ensure system
800///   stability.
801#[derive(Debug)]
802pub enum ComponentControllerRequest {
803    /// Request to stop the component instance.
804    ///
805    /// After stopping the component instance, the server should close this
806    /// connection with an epitaph. After the connection
807    /// closes, component manager considers this component instance to be
808    /// Stopped and the component's namespace will be torn down.
809    Stop { control_handle: ComponentControllerControlHandle },
810    /// Stop this component instance immediately.
811    ///
812    /// The ComponentRunner must immediately kill the component instance, and
813    /// then close this connection with an epitaph. After the connection
814    /// closes, component manager considers this component instance to be
815    /// Stopped and the component's namespace will be torn down.
816    ///
817    /// In some cases Kill() may be issued before Stop(), but that is not
818    /// guaranteed.
819    Kill { control_handle: ComponentControllerControlHandle },
820    /// An interaction was received which does not match any known method.
821    #[non_exhaustive]
822    _UnknownMethod {
823        /// Ordinal of the method that was called.
824        ordinal: u64,
825        control_handle: ComponentControllerControlHandle,
826        method_type: fidl::MethodType,
827    },
828}
829
830impl ComponentControllerRequest {
831    #[allow(irrefutable_let_patterns)]
832    pub fn into_stop(self) -> Option<(ComponentControllerControlHandle)> {
833        if let ComponentControllerRequest::Stop { control_handle } = self {
834            Some((control_handle))
835        } else {
836            None
837        }
838    }
839
840    #[allow(irrefutable_let_patterns)]
841    pub fn into_kill(self) -> Option<(ComponentControllerControlHandle)> {
842        if let ComponentControllerRequest::Kill { control_handle } = self {
843            Some((control_handle))
844        } else {
845            None
846        }
847    }
848
849    /// Name of the method defined in FIDL
850    pub fn method_name(&self) -> &'static str {
851        match *self {
852            ComponentControllerRequest::Stop { .. } => "stop",
853            ComponentControllerRequest::Kill { .. } => "kill",
854            ComponentControllerRequest::_UnknownMethod {
855                method_type: fidl::MethodType::OneWay,
856                ..
857            } => "unknown one-way method",
858            ComponentControllerRequest::_UnknownMethod {
859                method_type: fidl::MethodType::TwoWay,
860                ..
861            } => "unknown two-way method",
862        }
863    }
864}
865
866#[derive(Debug, Clone)]
867pub struct ComponentControllerControlHandle {
868    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
869}
870
871impl fidl::endpoints::ControlHandle for ComponentControllerControlHandle {
872    fn shutdown(&self) {
873        self.inner.shutdown()
874    }
875
876    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
877        self.inner.shutdown_with_epitaph(status)
878    }
879
880    fn is_closed(&self) -> bool {
881        self.inner.channel().is_closed()
882    }
883    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
884        self.inner.channel().on_closed()
885    }
886
887    #[cfg(target_os = "fuchsia")]
888    fn signal_peer(
889        &self,
890        clear_mask: zx::Signals,
891        set_mask: zx::Signals,
892    ) -> Result<(), zx_status::Status> {
893        use fidl::Peered;
894        self.inner.channel().signal_peer(clear_mask, set_mask)
895    }
896}
897
898impl ComponentControllerControlHandle {
899    pub fn send_on_publish_diagnostics(
900        &self,
901        mut payload: ComponentDiagnostics,
902    ) -> Result<(), fidl::Error> {
903        self.inner.send::<ComponentControllerOnPublishDiagnosticsRequest>(
904            (&mut payload,),
905            0,
906            0x1f16d8c3c49c6947,
907            fidl::encoding::DynamicFlags::empty(),
908        )
909    }
910
911    pub fn send_on_escrow(
912        &self,
913        mut payload: ComponentControllerOnEscrowRequest,
914    ) -> Result<(), fidl::Error> {
915        self.inner.send::<ComponentControllerOnEscrowRequest>(
916            &mut payload,
917            0,
918            0xa231349355343fc,
919            fidl::encoding::DynamicFlags::FLEXIBLE,
920        )
921    }
922
923    pub fn send_on_stop(&self, mut payload: ComponentStopInfo) -> Result<(), fidl::Error> {
924        self.inner.send::<ComponentStopInfo>(
925            &mut payload,
926            0,
927            0x3bfd24b031878ab2,
928            fidl::encoding::DynamicFlags::FLEXIBLE,
929        )
930    }
931}
932
933#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
934pub struct ComponentRunnerMarker;
935
936impl fidl::endpoints::ProtocolMarker for ComponentRunnerMarker {
937    type Proxy = ComponentRunnerProxy;
938    type RequestStream = ComponentRunnerRequestStream;
939    #[cfg(target_os = "fuchsia")]
940    type SynchronousProxy = ComponentRunnerSynchronousProxy;
941
942    const DEBUG_NAME: &'static str = "fuchsia.component.runner.ComponentRunner";
943}
944impl fidl::endpoints::DiscoverableProtocolMarker for ComponentRunnerMarker {}
945
946pub trait ComponentRunnerProxyInterface: Send + Sync {
947    fn r#start(
948        &self,
949        start_info: ComponentStartInfo,
950        controller: fidl::endpoints::ServerEnd<ComponentControllerMarker>,
951    ) -> Result<(), fidl::Error>;
952}
953#[derive(Debug)]
954#[cfg(target_os = "fuchsia")]
955pub struct ComponentRunnerSynchronousProxy {
956    client: fidl::client::sync::Client,
957}
958
959#[cfg(target_os = "fuchsia")]
960impl fidl::endpoints::SynchronousProxy for ComponentRunnerSynchronousProxy {
961    type Proxy = ComponentRunnerProxy;
962    type Protocol = ComponentRunnerMarker;
963
964    fn from_channel(inner: fidl::Channel) -> Self {
965        Self::new(inner)
966    }
967
968    fn into_channel(self) -> fidl::Channel {
969        self.client.into_channel()
970    }
971
972    fn as_channel(&self) -> &fidl::Channel {
973        self.client.as_channel()
974    }
975}
976
977#[cfg(target_os = "fuchsia")]
978impl ComponentRunnerSynchronousProxy {
979    pub fn new(channel: fidl::Channel) -> Self {
980        Self { client: fidl::client::sync::Client::new(channel) }
981    }
982
983    pub fn into_channel(self) -> fidl::Channel {
984        self.client.into_channel()
985    }
986
987    /// Waits until an event arrives and returns it. It is safe for other
988    /// threads to make concurrent requests while waiting for an event.
989    pub fn wait_for_event(
990        &self,
991        deadline: zx::MonotonicInstant,
992    ) -> Result<ComponentRunnerEvent, fidl::Error> {
993        ComponentRunnerEvent::decode(self.client.wait_for_event::<ComponentRunnerMarker>(deadline)?)
994    }
995
996    /// Start running a component instance described by `start_info`.
997    ///
998    /// Component manager binds and uses `controller` to control the
999    /// lifetime of the newly started component instance.
1000    ///
1001    /// Errors are delivered as epitaphs over the `ComponentController`
1002    /// protocol. In the event of an error, the runner must ensure that
1003    /// resources are cleaned up.
1004    pub fn r#start(
1005        &self,
1006        mut start_info: ComponentStartInfo,
1007        mut controller: fidl::endpoints::ServerEnd<ComponentControllerMarker>,
1008    ) -> Result<(), fidl::Error> {
1009        self.client.send::<ComponentRunnerStartRequest>(
1010            (&mut start_info, controller),
1011            0xad5a8c19f25ee09,
1012            fidl::encoding::DynamicFlags::empty(),
1013        )
1014    }
1015}
1016
1017#[cfg(target_os = "fuchsia")]
1018impl From<ComponentRunnerSynchronousProxy> for zx::NullableHandle {
1019    fn from(value: ComponentRunnerSynchronousProxy) -> Self {
1020        value.into_channel().into()
1021    }
1022}
1023
1024#[cfg(target_os = "fuchsia")]
1025impl From<fidl::Channel> for ComponentRunnerSynchronousProxy {
1026    fn from(value: fidl::Channel) -> Self {
1027        Self::new(value)
1028    }
1029}
1030
1031#[cfg(target_os = "fuchsia")]
1032impl fidl::endpoints::FromClient for ComponentRunnerSynchronousProxy {
1033    type Protocol = ComponentRunnerMarker;
1034
1035    fn from_client(value: fidl::endpoints::ClientEnd<ComponentRunnerMarker>) -> Self {
1036        Self::new(value.into_channel())
1037    }
1038}
1039
1040#[derive(Debug, Clone)]
1041pub struct ComponentRunnerProxy {
1042    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1043}
1044
1045impl fidl::endpoints::Proxy for ComponentRunnerProxy {
1046    type Protocol = ComponentRunnerMarker;
1047
1048    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1049        Self::new(inner)
1050    }
1051
1052    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1053        self.client.into_channel().map_err(|client| Self { client })
1054    }
1055
1056    fn as_channel(&self) -> &::fidl::AsyncChannel {
1057        self.client.as_channel()
1058    }
1059}
1060
1061impl ComponentRunnerProxy {
1062    /// Create a new Proxy for fuchsia.component.runner/ComponentRunner.
1063    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1064        let protocol_name = <ComponentRunnerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1065        Self { client: fidl::client::Client::new(channel, protocol_name) }
1066    }
1067
1068    /// Get a Stream of events from the remote end of the protocol.
1069    ///
1070    /// # Panics
1071    ///
1072    /// Panics if the event stream was already taken.
1073    pub fn take_event_stream(&self) -> ComponentRunnerEventStream {
1074        ComponentRunnerEventStream { event_receiver: self.client.take_event_receiver() }
1075    }
1076
1077    /// Start running a component instance described by `start_info`.
1078    ///
1079    /// Component manager binds and uses `controller` to control the
1080    /// lifetime of the newly started component instance.
1081    ///
1082    /// Errors are delivered as epitaphs over the `ComponentController`
1083    /// protocol. In the event of an error, the runner must ensure that
1084    /// resources are cleaned up.
1085    pub fn r#start(
1086        &self,
1087        mut start_info: ComponentStartInfo,
1088        mut controller: fidl::endpoints::ServerEnd<ComponentControllerMarker>,
1089    ) -> Result<(), fidl::Error> {
1090        ComponentRunnerProxyInterface::r#start(self, start_info, controller)
1091    }
1092}
1093
1094impl ComponentRunnerProxyInterface for ComponentRunnerProxy {
1095    fn r#start(
1096        &self,
1097        mut start_info: ComponentStartInfo,
1098        mut controller: fidl::endpoints::ServerEnd<ComponentControllerMarker>,
1099    ) -> Result<(), fidl::Error> {
1100        self.client.send::<ComponentRunnerStartRequest>(
1101            (&mut start_info, controller),
1102            0xad5a8c19f25ee09,
1103            fidl::encoding::DynamicFlags::empty(),
1104        )
1105    }
1106}
1107
1108pub struct ComponentRunnerEventStream {
1109    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1110}
1111
1112impl std::marker::Unpin for ComponentRunnerEventStream {}
1113
1114impl futures::stream::FusedStream for ComponentRunnerEventStream {
1115    fn is_terminated(&self) -> bool {
1116        self.event_receiver.is_terminated()
1117    }
1118}
1119
1120impl futures::Stream for ComponentRunnerEventStream {
1121    type Item = Result<ComponentRunnerEvent, fidl::Error>;
1122
1123    fn poll_next(
1124        mut self: std::pin::Pin<&mut Self>,
1125        cx: &mut std::task::Context<'_>,
1126    ) -> std::task::Poll<Option<Self::Item>> {
1127        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1128            &mut self.event_receiver,
1129            cx
1130        )?) {
1131            Some(buf) => std::task::Poll::Ready(Some(ComponentRunnerEvent::decode(buf))),
1132            None => std::task::Poll::Ready(None),
1133        }
1134    }
1135}
1136
1137#[derive(Debug)]
1138pub enum ComponentRunnerEvent {
1139    #[non_exhaustive]
1140    _UnknownEvent {
1141        /// Ordinal of the event that was sent.
1142        ordinal: u64,
1143    },
1144}
1145
1146impl ComponentRunnerEvent {
1147    /// Decodes a message buffer as a [`ComponentRunnerEvent`].
1148    fn decode(
1149        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1150    ) -> Result<ComponentRunnerEvent, fidl::Error> {
1151        let (bytes, _handles) = buf.split_mut();
1152        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1153        debug_assert_eq!(tx_header.tx_id, 0);
1154        match tx_header.ordinal {
1155            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1156                Ok(ComponentRunnerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1157            }
1158            _ => Err(fidl::Error::UnknownOrdinal {
1159                ordinal: tx_header.ordinal,
1160                protocol_name:
1161                    <ComponentRunnerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1162            }),
1163        }
1164    }
1165}
1166
1167/// A Stream of incoming requests for fuchsia.component.runner/ComponentRunner.
1168pub struct ComponentRunnerRequestStream {
1169    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1170    is_terminated: bool,
1171}
1172
1173impl std::marker::Unpin for ComponentRunnerRequestStream {}
1174
1175impl futures::stream::FusedStream for ComponentRunnerRequestStream {
1176    fn is_terminated(&self) -> bool {
1177        self.is_terminated
1178    }
1179}
1180
1181impl fidl::endpoints::RequestStream for ComponentRunnerRequestStream {
1182    type Protocol = ComponentRunnerMarker;
1183    type ControlHandle = ComponentRunnerControlHandle;
1184
1185    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1186        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1187    }
1188
1189    fn control_handle(&self) -> Self::ControlHandle {
1190        ComponentRunnerControlHandle { inner: self.inner.clone() }
1191    }
1192
1193    fn into_inner(
1194        self,
1195    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1196    {
1197        (self.inner, self.is_terminated)
1198    }
1199
1200    fn from_inner(
1201        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1202        is_terminated: bool,
1203    ) -> Self {
1204        Self { inner, is_terminated }
1205    }
1206}
1207
1208impl futures::Stream for ComponentRunnerRequestStream {
1209    type Item = Result<ComponentRunnerRequest, fidl::Error>;
1210
1211    fn poll_next(
1212        mut self: std::pin::Pin<&mut Self>,
1213        cx: &mut std::task::Context<'_>,
1214    ) -> std::task::Poll<Option<Self::Item>> {
1215        let this = &mut *self;
1216        if this.inner.check_shutdown(cx) {
1217            this.is_terminated = true;
1218            return std::task::Poll::Ready(None);
1219        }
1220        if this.is_terminated {
1221            panic!("polled ComponentRunnerRequestStream after completion");
1222        }
1223        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1224            |bytes, handles| {
1225                match this.inner.channel().read_etc(cx, bytes, handles) {
1226                    std::task::Poll::Ready(Ok(())) => {}
1227                    std::task::Poll::Pending => return std::task::Poll::Pending,
1228                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1229                        this.is_terminated = true;
1230                        return std::task::Poll::Ready(None);
1231                    }
1232                    std::task::Poll::Ready(Err(e)) => {
1233                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1234                            e.into(),
1235                        ))));
1236                    }
1237                }
1238
1239                // A message has been received from the channel
1240                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1241
1242                std::task::Poll::Ready(Some(match header.ordinal {
1243                    0xad5a8c19f25ee09 => {
1244                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1245                        let mut req = fidl::new_empty!(
1246                            ComponentRunnerStartRequest,
1247                            fidl::encoding::DefaultFuchsiaResourceDialect
1248                        );
1249                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ComponentRunnerStartRequest>(&header, _body_bytes, handles, &mut req)?;
1250                        let control_handle =
1251                            ComponentRunnerControlHandle { inner: this.inner.clone() };
1252                        Ok(ComponentRunnerRequest::Start {
1253                            start_info: req.start_info,
1254                            controller: req.controller,
1255
1256                            control_handle,
1257                        })
1258                    }
1259                    _ if header.tx_id == 0
1260                        && header
1261                            .dynamic_flags()
1262                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1263                    {
1264                        Ok(ComponentRunnerRequest::_UnknownMethod {
1265                            ordinal: header.ordinal,
1266                            control_handle: ComponentRunnerControlHandle {
1267                                inner: this.inner.clone(),
1268                            },
1269                            method_type: fidl::MethodType::OneWay,
1270                        })
1271                    }
1272                    _ if header
1273                        .dynamic_flags()
1274                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1275                    {
1276                        this.inner.send_framework_err(
1277                            fidl::encoding::FrameworkErr::UnknownMethod,
1278                            header.tx_id,
1279                            header.ordinal,
1280                            header.dynamic_flags(),
1281                            (bytes, handles),
1282                        )?;
1283                        Ok(ComponentRunnerRequest::_UnknownMethod {
1284                            ordinal: header.ordinal,
1285                            control_handle: ComponentRunnerControlHandle {
1286                                inner: this.inner.clone(),
1287                            },
1288                            method_type: fidl::MethodType::TwoWay,
1289                        })
1290                    }
1291                    _ => Err(fidl::Error::UnknownOrdinal {
1292                        ordinal: header.ordinal,
1293                        protocol_name:
1294                            <ComponentRunnerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1295                    }),
1296                }))
1297            },
1298        )
1299    }
1300}
1301
1302/// A protocol used for running components.
1303///
1304/// This protocol is implemented by components which provide a runtime
1305/// environment for other components.
1306///
1307/// Note: The component manager is the only intended direct client of this
1308/// interface.
1309#[derive(Debug)]
1310pub enum ComponentRunnerRequest {
1311    /// Start running a component instance described by `start_info`.
1312    ///
1313    /// Component manager binds and uses `controller` to control the
1314    /// lifetime of the newly started component instance.
1315    ///
1316    /// Errors are delivered as epitaphs over the `ComponentController`
1317    /// protocol. In the event of an error, the runner must ensure that
1318    /// resources are cleaned up.
1319    Start {
1320        start_info: ComponentStartInfo,
1321        controller: fidl::endpoints::ServerEnd<ComponentControllerMarker>,
1322        control_handle: ComponentRunnerControlHandle,
1323    },
1324    /// An interaction was received which does not match any known method.
1325    #[non_exhaustive]
1326    _UnknownMethod {
1327        /// Ordinal of the method that was called.
1328        ordinal: u64,
1329        control_handle: ComponentRunnerControlHandle,
1330        method_type: fidl::MethodType,
1331    },
1332}
1333
1334impl ComponentRunnerRequest {
1335    #[allow(irrefutable_let_patterns)]
1336    pub fn into_start(
1337        self,
1338    ) -> Option<(
1339        ComponentStartInfo,
1340        fidl::endpoints::ServerEnd<ComponentControllerMarker>,
1341        ComponentRunnerControlHandle,
1342    )> {
1343        if let ComponentRunnerRequest::Start { start_info, controller, control_handle } = self {
1344            Some((start_info, controller, control_handle))
1345        } else {
1346            None
1347        }
1348    }
1349
1350    /// Name of the method defined in FIDL
1351    pub fn method_name(&self) -> &'static str {
1352        match *self {
1353            ComponentRunnerRequest::Start { .. } => "start",
1354            ComponentRunnerRequest::_UnknownMethod {
1355                method_type: fidl::MethodType::OneWay,
1356                ..
1357            } => "unknown one-way method",
1358            ComponentRunnerRequest::_UnknownMethod {
1359                method_type: fidl::MethodType::TwoWay,
1360                ..
1361            } => "unknown two-way method",
1362        }
1363    }
1364}
1365
1366#[derive(Debug, Clone)]
1367pub struct ComponentRunnerControlHandle {
1368    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1369}
1370
1371impl fidl::endpoints::ControlHandle for ComponentRunnerControlHandle {
1372    fn shutdown(&self) {
1373        self.inner.shutdown()
1374    }
1375
1376    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1377        self.inner.shutdown_with_epitaph(status)
1378    }
1379
1380    fn is_closed(&self) -> bool {
1381        self.inner.channel().is_closed()
1382    }
1383    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1384        self.inner.channel().on_closed()
1385    }
1386
1387    #[cfg(target_os = "fuchsia")]
1388    fn signal_peer(
1389        &self,
1390        clear_mask: zx::Signals,
1391        set_mask: zx::Signals,
1392    ) -> Result<(), zx_status::Status> {
1393        use fidl::Peered;
1394        self.inner.channel().signal_peer(clear_mask, set_mask)
1395    }
1396}
1397
1398impl ComponentRunnerControlHandle {}
1399
1400#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1401pub struct TaskProviderMarker;
1402
1403impl fidl::endpoints::ProtocolMarker for TaskProviderMarker {
1404    type Proxy = TaskProviderProxy;
1405    type RequestStream = TaskProviderRequestStream;
1406    #[cfg(target_os = "fuchsia")]
1407    type SynchronousProxy = TaskProviderSynchronousProxy;
1408
1409    const DEBUG_NAME: &'static str = "fuchsia.component.runner.TaskProvider";
1410}
1411impl fidl::endpoints::DiscoverableProtocolMarker for TaskProviderMarker {}
1412pub type TaskProviderGetJobResult = Result<fidl::Job, i32>;
1413
1414pub trait TaskProviderProxyInterface: Send + Sync {
1415    type GetJobResponseFut: std::future::Future<Output = Result<TaskProviderGetJobResult, fidl::Error>>
1416        + Send;
1417    fn r#get_job(&self) -> Self::GetJobResponseFut;
1418}
1419#[derive(Debug)]
1420#[cfg(target_os = "fuchsia")]
1421pub struct TaskProviderSynchronousProxy {
1422    client: fidl::client::sync::Client,
1423}
1424
1425#[cfg(target_os = "fuchsia")]
1426impl fidl::endpoints::SynchronousProxy for TaskProviderSynchronousProxy {
1427    type Proxy = TaskProviderProxy;
1428    type Protocol = TaskProviderMarker;
1429
1430    fn from_channel(inner: fidl::Channel) -> Self {
1431        Self::new(inner)
1432    }
1433
1434    fn into_channel(self) -> fidl::Channel {
1435        self.client.into_channel()
1436    }
1437
1438    fn as_channel(&self) -> &fidl::Channel {
1439        self.client.as_channel()
1440    }
1441}
1442
1443#[cfg(target_os = "fuchsia")]
1444impl TaskProviderSynchronousProxy {
1445    pub fn new(channel: fidl::Channel) -> Self {
1446        Self { client: fidl::client::sync::Client::new(channel) }
1447    }
1448
1449    pub fn into_channel(self) -> fidl::Channel {
1450        self.client.into_channel()
1451    }
1452
1453    /// Waits until an event arrives and returns it. It is safe for other
1454    /// threads to make concurrent requests while waiting for an event.
1455    pub fn wait_for_event(
1456        &self,
1457        deadline: zx::MonotonicInstant,
1458    ) -> Result<TaskProviderEvent, fidl::Error> {
1459        TaskProviderEvent::decode(self.client.wait_for_event::<TaskProviderMarker>(deadline)?)
1460    }
1461
1462    /// Returns a job handle for the component requested.
1463    ///
1464    /// On success, returns a handle with the same rights as the runner's.
1465    pub fn r#get_job(
1466        &self,
1467        ___deadline: zx::MonotonicInstant,
1468    ) -> Result<TaskProviderGetJobResult, fidl::Error> {
1469        let _response = self.client.send_query::<
1470            fidl::encoding::EmptyPayload,
1471            fidl::encoding::ResultType<TaskProviderGetJobResponse, i32>,
1472            TaskProviderMarker,
1473        >(
1474            (),
1475            0x4c9ca4f4fdece3ad,
1476            fidl::encoding::DynamicFlags::empty(),
1477            ___deadline,
1478        )?;
1479        Ok(_response.map(|x| x.job))
1480    }
1481}
1482
1483#[cfg(target_os = "fuchsia")]
1484impl From<TaskProviderSynchronousProxy> for zx::NullableHandle {
1485    fn from(value: TaskProviderSynchronousProxy) -> Self {
1486        value.into_channel().into()
1487    }
1488}
1489
1490#[cfg(target_os = "fuchsia")]
1491impl From<fidl::Channel> for TaskProviderSynchronousProxy {
1492    fn from(value: fidl::Channel) -> Self {
1493        Self::new(value)
1494    }
1495}
1496
1497#[cfg(target_os = "fuchsia")]
1498impl fidl::endpoints::FromClient for TaskProviderSynchronousProxy {
1499    type Protocol = TaskProviderMarker;
1500
1501    fn from_client(value: fidl::endpoints::ClientEnd<TaskProviderMarker>) -> Self {
1502        Self::new(value.into_channel())
1503    }
1504}
1505
1506#[derive(Debug, Clone)]
1507pub struct TaskProviderProxy {
1508    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1509}
1510
1511impl fidl::endpoints::Proxy for TaskProviderProxy {
1512    type Protocol = TaskProviderMarker;
1513
1514    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1515        Self::new(inner)
1516    }
1517
1518    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1519        self.client.into_channel().map_err(|client| Self { client })
1520    }
1521
1522    fn as_channel(&self) -> &::fidl::AsyncChannel {
1523        self.client.as_channel()
1524    }
1525}
1526
1527impl TaskProviderProxy {
1528    /// Create a new Proxy for fuchsia.component.runner/TaskProvider.
1529    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1530        let protocol_name = <TaskProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1531        Self { client: fidl::client::Client::new(channel, protocol_name) }
1532    }
1533
1534    /// Get a Stream of events from the remote end of the protocol.
1535    ///
1536    /// # Panics
1537    ///
1538    /// Panics if the event stream was already taken.
1539    pub fn take_event_stream(&self) -> TaskProviderEventStream {
1540        TaskProviderEventStream { event_receiver: self.client.take_event_receiver() }
1541    }
1542
1543    /// Returns a job handle for the component requested.
1544    ///
1545    /// On success, returns a handle with the same rights as the runner's.
1546    pub fn r#get_job(
1547        &self,
1548    ) -> fidl::client::QueryResponseFut<
1549        TaskProviderGetJobResult,
1550        fidl::encoding::DefaultFuchsiaResourceDialect,
1551    > {
1552        TaskProviderProxyInterface::r#get_job(self)
1553    }
1554}
1555
1556impl TaskProviderProxyInterface for TaskProviderProxy {
1557    type GetJobResponseFut = fidl::client::QueryResponseFut<
1558        TaskProviderGetJobResult,
1559        fidl::encoding::DefaultFuchsiaResourceDialect,
1560    >;
1561    fn r#get_job(&self) -> Self::GetJobResponseFut {
1562        fn _decode(
1563            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1564        ) -> Result<TaskProviderGetJobResult, fidl::Error> {
1565            let _response = fidl::client::decode_transaction_body::<
1566                fidl::encoding::ResultType<TaskProviderGetJobResponse, i32>,
1567                fidl::encoding::DefaultFuchsiaResourceDialect,
1568                0x4c9ca4f4fdece3ad,
1569            >(_buf?)?;
1570            Ok(_response.map(|x| x.job))
1571        }
1572        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, TaskProviderGetJobResult>(
1573            (),
1574            0x4c9ca4f4fdece3ad,
1575            fidl::encoding::DynamicFlags::empty(),
1576            _decode,
1577        )
1578    }
1579}
1580
1581pub struct TaskProviderEventStream {
1582    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1583}
1584
1585impl std::marker::Unpin for TaskProviderEventStream {}
1586
1587impl futures::stream::FusedStream for TaskProviderEventStream {
1588    fn is_terminated(&self) -> bool {
1589        self.event_receiver.is_terminated()
1590    }
1591}
1592
1593impl futures::Stream for TaskProviderEventStream {
1594    type Item = Result<TaskProviderEvent, fidl::Error>;
1595
1596    fn poll_next(
1597        mut self: std::pin::Pin<&mut Self>,
1598        cx: &mut std::task::Context<'_>,
1599    ) -> std::task::Poll<Option<Self::Item>> {
1600        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1601            &mut self.event_receiver,
1602            cx
1603        )?) {
1604            Some(buf) => std::task::Poll::Ready(Some(TaskProviderEvent::decode(buf))),
1605            None => std::task::Poll::Ready(None),
1606        }
1607    }
1608}
1609
1610#[derive(Debug)]
1611pub enum TaskProviderEvent {
1612    #[non_exhaustive]
1613    _UnknownEvent {
1614        /// Ordinal of the event that was sent.
1615        ordinal: u64,
1616    },
1617}
1618
1619impl TaskProviderEvent {
1620    /// Decodes a message buffer as a [`TaskProviderEvent`].
1621    fn decode(
1622        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1623    ) -> Result<TaskProviderEvent, fidl::Error> {
1624        let (bytes, _handles) = buf.split_mut();
1625        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1626        debug_assert_eq!(tx_header.tx_id, 0);
1627        match tx_header.ordinal {
1628            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1629                Ok(TaskProviderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1630            }
1631            _ => Err(fidl::Error::UnknownOrdinal {
1632                ordinal: tx_header.ordinal,
1633                protocol_name: <TaskProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1634            }),
1635        }
1636    }
1637}
1638
1639/// A Stream of incoming requests for fuchsia.component.runner/TaskProvider.
1640pub struct TaskProviderRequestStream {
1641    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1642    is_terminated: bool,
1643}
1644
1645impl std::marker::Unpin for TaskProviderRequestStream {}
1646
1647impl futures::stream::FusedStream for TaskProviderRequestStream {
1648    fn is_terminated(&self) -> bool {
1649        self.is_terminated
1650    }
1651}
1652
1653impl fidl::endpoints::RequestStream for TaskProviderRequestStream {
1654    type Protocol = TaskProviderMarker;
1655    type ControlHandle = TaskProviderControlHandle;
1656
1657    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1658        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1659    }
1660
1661    fn control_handle(&self) -> Self::ControlHandle {
1662        TaskProviderControlHandle { inner: self.inner.clone() }
1663    }
1664
1665    fn into_inner(
1666        self,
1667    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1668    {
1669        (self.inner, self.is_terminated)
1670    }
1671
1672    fn from_inner(
1673        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1674        is_terminated: bool,
1675    ) -> Self {
1676        Self { inner, is_terminated }
1677    }
1678}
1679
1680impl futures::Stream for TaskProviderRequestStream {
1681    type Item = Result<TaskProviderRequest, fidl::Error>;
1682
1683    fn poll_next(
1684        mut self: std::pin::Pin<&mut Self>,
1685        cx: &mut std::task::Context<'_>,
1686    ) -> std::task::Poll<Option<Self::Item>> {
1687        let this = &mut *self;
1688        if this.inner.check_shutdown(cx) {
1689            this.is_terminated = true;
1690            return std::task::Poll::Ready(None);
1691        }
1692        if this.is_terminated {
1693            panic!("polled TaskProviderRequestStream after completion");
1694        }
1695        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1696            |bytes, handles| {
1697                match this.inner.channel().read_etc(cx, bytes, handles) {
1698                    std::task::Poll::Ready(Ok(())) => {}
1699                    std::task::Poll::Pending => return std::task::Poll::Pending,
1700                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1701                        this.is_terminated = true;
1702                        return std::task::Poll::Ready(None);
1703                    }
1704                    std::task::Poll::Ready(Err(e)) => {
1705                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1706                            e.into(),
1707                        ))));
1708                    }
1709                }
1710
1711                // A message has been received from the channel
1712                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1713
1714                std::task::Poll::Ready(Some(match header.ordinal {
1715                    0x4c9ca4f4fdece3ad => {
1716                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1717                        let mut req = fidl::new_empty!(
1718                            fidl::encoding::EmptyPayload,
1719                            fidl::encoding::DefaultFuchsiaResourceDialect
1720                        );
1721                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1722                        let control_handle =
1723                            TaskProviderControlHandle { inner: this.inner.clone() };
1724                        Ok(TaskProviderRequest::GetJob {
1725                            responder: TaskProviderGetJobResponder {
1726                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1727                                tx_id: header.tx_id,
1728                            },
1729                        })
1730                    }
1731                    _ if header.tx_id == 0
1732                        && header
1733                            .dynamic_flags()
1734                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1735                    {
1736                        Ok(TaskProviderRequest::_UnknownMethod {
1737                            ordinal: header.ordinal,
1738                            control_handle: TaskProviderControlHandle { inner: this.inner.clone() },
1739                            method_type: fidl::MethodType::OneWay,
1740                        })
1741                    }
1742                    _ if header
1743                        .dynamic_flags()
1744                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1745                    {
1746                        this.inner.send_framework_err(
1747                            fidl::encoding::FrameworkErr::UnknownMethod,
1748                            header.tx_id,
1749                            header.ordinal,
1750                            header.dynamic_flags(),
1751                            (bytes, handles),
1752                        )?;
1753                        Ok(TaskProviderRequest::_UnknownMethod {
1754                            ordinal: header.ordinal,
1755                            control_handle: TaskProviderControlHandle { inner: this.inner.clone() },
1756                            method_type: fidl::MethodType::TwoWay,
1757                        })
1758                    }
1759                    _ => Err(fidl::Error::UnknownOrdinal {
1760                        ordinal: header.ordinal,
1761                        protocol_name:
1762                            <TaskProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1763                    }),
1764                }))
1765            },
1766        )
1767    }
1768}
1769
1770/// Served by runners that want to make a zircon job available through their runtime directory.
1771#[derive(Debug)]
1772pub enum TaskProviderRequest {
1773    /// Returns a job handle for the component requested.
1774    ///
1775    /// On success, returns a handle with the same rights as the runner's.
1776    GetJob { responder: TaskProviderGetJobResponder },
1777    /// An interaction was received which does not match any known method.
1778    #[non_exhaustive]
1779    _UnknownMethod {
1780        /// Ordinal of the method that was called.
1781        ordinal: u64,
1782        control_handle: TaskProviderControlHandle,
1783        method_type: fidl::MethodType,
1784    },
1785}
1786
1787impl TaskProviderRequest {
1788    #[allow(irrefutable_let_patterns)]
1789    pub fn into_get_job(self) -> Option<(TaskProviderGetJobResponder)> {
1790        if let TaskProviderRequest::GetJob { responder } = self { Some((responder)) } else { None }
1791    }
1792
1793    /// Name of the method defined in FIDL
1794    pub fn method_name(&self) -> &'static str {
1795        match *self {
1796            TaskProviderRequest::GetJob { .. } => "get_job",
1797            TaskProviderRequest::_UnknownMethod {
1798                method_type: fidl::MethodType::OneWay, ..
1799            } => "unknown one-way method",
1800            TaskProviderRequest::_UnknownMethod {
1801                method_type: fidl::MethodType::TwoWay, ..
1802            } => "unknown two-way method",
1803        }
1804    }
1805}
1806
1807#[derive(Debug, Clone)]
1808pub struct TaskProviderControlHandle {
1809    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1810}
1811
1812impl fidl::endpoints::ControlHandle for TaskProviderControlHandle {
1813    fn shutdown(&self) {
1814        self.inner.shutdown()
1815    }
1816
1817    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1818        self.inner.shutdown_with_epitaph(status)
1819    }
1820
1821    fn is_closed(&self) -> bool {
1822        self.inner.channel().is_closed()
1823    }
1824    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1825        self.inner.channel().on_closed()
1826    }
1827
1828    #[cfg(target_os = "fuchsia")]
1829    fn signal_peer(
1830        &self,
1831        clear_mask: zx::Signals,
1832        set_mask: zx::Signals,
1833    ) -> Result<(), zx_status::Status> {
1834        use fidl::Peered;
1835        self.inner.channel().signal_peer(clear_mask, set_mask)
1836    }
1837}
1838
1839impl TaskProviderControlHandle {}
1840
1841#[must_use = "FIDL methods require a response to be sent"]
1842#[derive(Debug)]
1843pub struct TaskProviderGetJobResponder {
1844    control_handle: std::mem::ManuallyDrop<TaskProviderControlHandle>,
1845    tx_id: u32,
1846}
1847
1848/// Set the the channel to be shutdown (see [`TaskProviderControlHandle::shutdown`])
1849/// if the responder is dropped without sending a response, so that the client
1850/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1851impl std::ops::Drop for TaskProviderGetJobResponder {
1852    fn drop(&mut self) {
1853        self.control_handle.shutdown();
1854        // Safety: drops once, never accessed again
1855        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1856    }
1857}
1858
1859impl fidl::endpoints::Responder for TaskProviderGetJobResponder {
1860    type ControlHandle = TaskProviderControlHandle;
1861
1862    fn control_handle(&self) -> &TaskProviderControlHandle {
1863        &self.control_handle
1864    }
1865
1866    fn drop_without_shutdown(mut self) {
1867        // Safety: drops once, never accessed again due to mem::forget
1868        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1869        // Prevent Drop from running (which would shut down the channel)
1870        std::mem::forget(self);
1871    }
1872}
1873
1874impl TaskProviderGetJobResponder {
1875    /// Sends a response to the FIDL transaction.
1876    ///
1877    /// Sets the channel to shutdown if an error occurs.
1878    pub fn send(self, mut result: Result<fidl::Job, i32>) -> Result<(), fidl::Error> {
1879        let _result = self.send_raw(result);
1880        if _result.is_err() {
1881            self.control_handle.shutdown();
1882        }
1883        self.drop_without_shutdown();
1884        _result
1885    }
1886
1887    /// Similar to "send" but does not shutdown the channel if an error occurs.
1888    pub fn send_no_shutdown_on_err(
1889        self,
1890        mut result: Result<fidl::Job, i32>,
1891    ) -> Result<(), fidl::Error> {
1892        let _result = self.send_raw(result);
1893        self.drop_without_shutdown();
1894        _result
1895    }
1896
1897    fn send_raw(&self, mut result: Result<fidl::Job, i32>) -> Result<(), fidl::Error> {
1898        self.control_handle
1899            .inner
1900            .send::<fidl::encoding::ResultType<TaskProviderGetJobResponse, i32>>(
1901                result.map(|job| (job,)),
1902                self.tx_id,
1903                0x4c9ca4f4fdece3ad,
1904                fidl::encoding::DynamicFlags::empty(),
1905            )
1906    }
1907}
1908
1909mod internal {
1910    use super::*;
1911
1912    impl fidl::encoding::ResourceTypeMarker for ComponentControllerOnPublishDiagnosticsRequest {
1913        type Borrowed<'a> = &'a mut Self;
1914        fn take_or_borrow<'a>(
1915            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1916        ) -> Self::Borrowed<'a> {
1917            value
1918        }
1919    }
1920
1921    unsafe impl fidl::encoding::TypeMarker for ComponentControllerOnPublishDiagnosticsRequest {
1922        type Owned = Self;
1923
1924        #[inline(always)]
1925        fn inline_align(_context: fidl::encoding::Context) -> usize {
1926            8
1927        }
1928
1929        #[inline(always)]
1930        fn inline_size(_context: fidl::encoding::Context) -> usize {
1931            16
1932        }
1933    }
1934
1935    unsafe impl
1936        fidl::encoding::Encode<
1937            ComponentControllerOnPublishDiagnosticsRequest,
1938            fidl::encoding::DefaultFuchsiaResourceDialect,
1939        > for &mut ComponentControllerOnPublishDiagnosticsRequest
1940    {
1941        #[inline]
1942        unsafe fn encode(
1943            self,
1944            encoder: &mut fidl::encoding::Encoder<
1945                '_,
1946                fidl::encoding::DefaultFuchsiaResourceDialect,
1947            >,
1948            offset: usize,
1949            _depth: fidl::encoding::Depth,
1950        ) -> fidl::Result<()> {
1951            encoder.debug_check_bounds::<ComponentControllerOnPublishDiagnosticsRequest>(offset);
1952            // Delegate to tuple encoding.
1953            fidl::encoding::Encode::<
1954                ComponentControllerOnPublishDiagnosticsRequest,
1955                fidl::encoding::DefaultFuchsiaResourceDialect,
1956            >::encode(
1957                (<ComponentDiagnostics as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1958                    &mut self.payload,
1959                ),),
1960                encoder,
1961                offset,
1962                _depth,
1963            )
1964        }
1965    }
1966    unsafe impl<
1967        T0: fidl::encoding::Encode<ComponentDiagnostics, fidl::encoding::DefaultFuchsiaResourceDialect>,
1968    >
1969        fidl::encoding::Encode<
1970            ComponentControllerOnPublishDiagnosticsRequest,
1971            fidl::encoding::DefaultFuchsiaResourceDialect,
1972        > for (T0,)
1973    {
1974        #[inline]
1975        unsafe fn encode(
1976            self,
1977            encoder: &mut fidl::encoding::Encoder<
1978                '_,
1979                fidl::encoding::DefaultFuchsiaResourceDialect,
1980            >,
1981            offset: usize,
1982            depth: fidl::encoding::Depth,
1983        ) -> fidl::Result<()> {
1984            encoder.debug_check_bounds::<ComponentControllerOnPublishDiagnosticsRequest>(offset);
1985            // Zero out padding regions. There's no need to apply masks
1986            // because the unmasked parts will be overwritten by fields.
1987            // Write the fields.
1988            self.0.encode(encoder, offset + 0, depth)?;
1989            Ok(())
1990        }
1991    }
1992
1993    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1994        for ComponentControllerOnPublishDiagnosticsRequest
1995    {
1996        #[inline(always)]
1997        fn new_empty() -> Self {
1998            Self {
1999                payload: fidl::new_empty!(
2000                    ComponentDiagnostics,
2001                    fidl::encoding::DefaultFuchsiaResourceDialect
2002                ),
2003            }
2004        }
2005
2006        #[inline]
2007        unsafe fn decode(
2008            &mut self,
2009            decoder: &mut fidl::encoding::Decoder<
2010                '_,
2011                fidl::encoding::DefaultFuchsiaResourceDialect,
2012            >,
2013            offset: usize,
2014            _depth: fidl::encoding::Depth,
2015        ) -> fidl::Result<()> {
2016            decoder.debug_check_bounds::<Self>(offset);
2017            // Verify that padding bytes are zero.
2018            fidl::decode!(
2019                ComponentDiagnostics,
2020                fidl::encoding::DefaultFuchsiaResourceDialect,
2021                &mut self.payload,
2022                decoder,
2023                offset + 0,
2024                _depth
2025            )?;
2026            Ok(())
2027        }
2028    }
2029
2030    impl fidl::encoding::ResourceTypeMarker for ComponentRunnerStartRequest {
2031        type Borrowed<'a> = &'a mut Self;
2032        fn take_or_borrow<'a>(
2033            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2034        ) -> Self::Borrowed<'a> {
2035            value
2036        }
2037    }
2038
2039    unsafe impl fidl::encoding::TypeMarker for ComponentRunnerStartRequest {
2040        type Owned = Self;
2041
2042        #[inline(always)]
2043        fn inline_align(_context: fidl::encoding::Context) -> usize {
2044            8
2045        }
2046
2047        #[inline(always)]
2048        fn inline_size(_context: fidl::encoding::Context) -> usize {
2049            24
2050        }
2051    }
2052
2053    unsafe impl
2054        fidl::encoding::Encode<
2055            ComponentRunnerStartRequest,
2056            fidl::encoding::DefaultFuchsiaResourceDialect,
2057        > for &mut ComponentRunnerStartRequest
2058    {
2059        #[inline]
2060        unsafe fn encode(
2061            self,
2062            encoder: &mut fidl::encoding::Encoder<
2063                '_,
2064                fidl::encoding::DefaultFuchsiaResourceDialect,
2065            >,
2066            offset: usize,
2067            _depth: fidl::encoding::Depth,
2068        ) -> fidl::Result<()> {
2069            encoder.debug_check_bounds::<ComponentRunnerStartRequest>(offset);
2070            // Delegate to tuple encoding.
2071            fidl::encoding::Encode::<ComponentRunnerStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2072                (
2073                    <ComponentStartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.start_info),
2074                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ComponentControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
2075                ),
2076                encoder, offset, _depth
2077            )
2078        }
2079    }
2080    unsafe impl<
2081        T0: fidl::encoding::Encode<ComponentStartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
2082        T1: fidl::encoding::Encode<
2083                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ComponentControllerMarker>>,
2084                fidl::encoding::DefaultFuchsiaResourceDialect,
2085            >,
2086    >
2087        fidl::encoding::Encode<
2088            ComponentRunnerStartRequest,
2089            fidl::encoding::DefaultFuchsiaResourceDialect,
2090        > for (T0, T1)
2091    {
2092        #[inline]
2093        unsafe fn encode(
2094            self,
2095            encoder: &mut fidl::encoding::Encoder<
2096                '_,
2097                fidl::encoding::DefaultFuchsiaResourceDialect,
2098            >,
2099            offset: usize,
2100            depth: fidl::encoding::Depth,
2101        ) -> fidl::Result<()> {
2102            encoder.debug_check_bounds::<ComponentRunnerStartRequest>(offset);
2103            // Zero out padding regions. There's no need to apply masks
2104            // because the unmasked parts will be overwritten by fields.
2105            unsafe {
2106                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2107                (ptr as *mut u64).write_unaligned(0);
2108            }
2109            // Write the fields.
2110            self.0.encode(encoder, offset + 0, depth)?;
2111            self.1.encode(encoder, offset + 16, depth)?;
2112            Ok(())
2113        }
2114    }
2115
2116    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2117        for ComponentRunnerStartRequest
2118    {
2119        #[inline(always)]
2120        fn new_empty() -> Self {
2121            Self {
2122                start_info: fidl::new_empty!(
2123                    ComponentStartInfo,
2124                    fidl::encoding::DefaultFuchsiaResourceDialect
2125                ),
2126                controller: fidl::new_empty!(
2127                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ComponentControllerMarker>>,
2128                    fidl::encoding::DefaultFuchsiaResourceDialect
2129                ),
2130            }
2131        }
2132
2133        #[inline]
2134        unsafe fn decode(
2135            &mut self,
2136            decoder: &mut fidl::encoding::Decoder<
2137                '_,
2138                fidl::encoding::DefaultFuchsiaResourceDialect,
2139            >,
2140            offset: usize,
2141            _depth: fidl::encoding::Depth,
2142        ) -> fidl::Result<()> {
2143            decoder.debug_check_bounds::<Self>(offset);
2144            // Verify that padding bytes are zero.
2145            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2146            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2147            let mask = 0xffffffff00000000u64;
2148            let maskedval = padval & mask;
2149            if maskedval != 0 {
2150                return Err(fidl::Error::NonZeroPadding {
2151                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2152                });
2153            }
2154            fidl::decode!(
2155                ComponentStartInfo,
2156                fidl::encoding::DefaultFuchsiaResourceDialect,
2157                &mut self.start_info,
2158                decoder,
2159                offset + 0,
2160                _depth
2161            )?;
2162            fidl::decode!(
2163                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ComponentControllerMarker>>,
2164                fidl::encoding::DefaultFuchsiaResourceDialect,
2165                &mut self.controller,
2166                decoder,
2167                offset + 16,
2168                _depth
2169            )?;
2170            Ok(())
2171        }
2172    }
2173
2174    impl fidl::encoding::ResourceTypeMarker for TaskProviderGetJobResponse {
2175        type Borrowed<'a> = &'a mut Self;
2176        fn take_or_borrow<'a>(
2177            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2178        ) -> Self::Borrowed<'a> {
2179            value
2180        }
2181    }
2182
2183    unsafe impl fidl::encoding::TypeMarker for TaskProviderGetJobResponse {
2184        type Owned = Self;
2185
2186        #[inline(always)]
2187        fn inline_align(_context: fidl::encoding::Context) -> usize {
2188            4
2189        }
2190
2191        #[inline(always)]
2192        fn inline_size(_context: fidl::encoding::Context) -> usize {
2193            4
2194        }
2195    }
2196
2197    unsafe impl
2198        fidl::encoding::Encode<
2199            TaskProviderGetJobResponse,
2200            fidl::encoding::DefaultFuchsiaResourceDialect,
2201        > for &mut TaskProviderGetJobResponse
2202    {
2203        #[inline]
2204        unsafe fn encode(
2205            self,
2206            encoder: &mut fidl::encoding::Encoder<
2207                '_,
2208                fidl::encoding::DefaultFuchsiaResourceDialect,
2209            >,
2210            offset: usize,
2211            _depth: fidl::encoding::Depth,
2212        ) -> fidl::Result<()> {
2213            encoder.debug_check_bounds::<TaskProviderGetJobResponse>(offset);
2214            // Delegate to tuple encoding.
2215            fidl::encoding::Encode::<
2216                TaskProviderGetJobResponse,
2217                fidl::encoding::DefaultFuchsiaResourceDialect,
2218            >::encode(
2219                (<fidl::encoding::HandleType<
2220                    fidl::Job,
2221                    { fidl::ObjectType::JOB.into_raw() },
2222                    2147483648,
2223                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2224                    &mut self.job
2225                ),),
2226                encoder,
2227                offset,
2228                _depth,
2229            )
2230        }
2231    }
2232    unsafe impl<
2233        T0: fidl::encoding::Encode<
2234                fidl::encoding::HandleType<
2235                    fidl::Job,
2236                    { fidl::ObjectType::JOB.into_raw() },
2237                    2147483648,
2238                >,
2239                fidl::encoding::DefaultFuchsiaResourceDialect,
2240            >,
2241    >
2242        fidl::encoding::Encode<
2243            TaskProviderGetJobResponse,
2244            fidl::encoding::DefaultFuchsiaResourceDialect,
2245        > for (T0,)
2246    {
2247        #[inline]
2248        unsafe fn encode(
2249            self,
2250            encoder: &mut fidl::encoding::Encoder<
2251                '_,
2252                fidl::encoding::DefaultFuchsiaResourceDialect,
2253            >,
2254            offset: usize,
2255            depth: fidl::encoding::Depth,
2256        ) -> fidl::Result<()> {
2257            encoder.debug_check_bounds::<TaskProviderGetJobResponse>(offset);
2258            // Zero out padding regions. There's no need to apply masks
2259            // because the unmasked parts will be overwritten by fields.
2260            // Write the fields.
2261            self.0.encode(encoder, offset + 0, depth)?;
2262            Ok(())
2263        }
2264    }
2265
2266    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2267        for TaskProviderGetJobResponse
2268    {
2269        #[inline(always)]
2270        fn new_empty() -> Self {
2271            Self {
2272                job: fidl::new_empty!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2273            }
2274        }
2275
2276        #[inline]
2277        unsafe fn decode(
2278            &mut self,
2279            decoder: &mut fidl::encoding::Decoder<
2280                '_,
2281                fidl::encoding::DefaultFuchsiaResourceDialect,
2282            >,
2283            offset: usize,
2284            _depth: fidl::encoding::Depth,
2285        ) -> fidl::Result<()> {
2286            decoder.debug_check_bounds::<Self>(offset);
2287            // Verify that padding bytes are zero.
2288            fidl::decode!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.job, decoder, offset + 0, _depth)?;
2289            Ok(())
2290        }
2291    }
2292
2293    impl ComponentControllerOnEscrowRequest {
2294        #[inline(always)]
2295        fn max_ordinal_present(&self) -> u64 {
2296            if let Some(_) = self.escrowed_dictionary_handle {
2297                return 3;
2298            }
2299            if let Some(_) = self.escrowed_dictionary {
2300                return 2;
2301            }
2302            if let Some(_) = self.outgoing_dir {
2303                return 1;
2304            }
2305            0
2306        }
2307    }
2308
2309    impl fidl::encoding::ResourceTypeMarker for ComponentControllerOnEscrowRequest {
2310        type Borrowed<'a> = &'a mut Self;
2311        fn take_or_borrow<'a>(
2312            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2313        ) -> Self::Borrowed<'a> {
2314            value
2315        }
2316    }
2317
2318    unsafe impl fidl::encoding::TypeMarker for ComponentControllerOnEscrowRequest {
2319        type Owned = Self;
2320
2321        #[inline(always)]
2322        fn inline_align(_context: fidl::encoding::Context) -> usize {
2323            8
2324        }
2325
2326        #[inline(always)]
2327        fn inline_size(_context: fidl::encoding::Context) -> usize {
2328            16
2329        }
2330    }
2331
2332    unsafe impl
2333        fidl::encoding::Encode<
2334            ComponentControllerOnEscrowRequest,
2335            fidl::encoding::DefaultFuchsiaResourceDialect,
2336        > for &mut ComponentControllerOnEscrowRequest
2337    {
2338        unsafe fn encode(
2339            self,
2340            encoder: &mut fidl::encoding::Encoder<
2341                '_,
2342                fidl::encoding::DefaultFuchsiaResourceDialect,
2343            >,
2344            offset: usize,
2345            mut depth: fidl::encoding::Depth,
2346        ) -> fidl::Result<()> {
2347            encoder.debug_check_bounds::<ComponentControllerOnEscrowRequest>(offset);
2348            // Vector header
2349            let max_ordinal: u64 = self.max_ordinal_present();
2350            encoder.write_num(max_ordinal, offset);
2351            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2352            // Calling encoder.out_of_line_offset(0) is not allowed.
2353            if max_ordinal == 0 {
2354                return Ok(());
2355            }
2356            depth.increment()?;
2357            let envelope_size = 8;
2358            let bytes_len = max_ordinal as usize * envelope_size;
2359            #[allow(unused_variables)]
2360            let offset = encoder.out_of_line_offset(bytes_len);
2361            let mut _prev_end_offset: usize = 0;
2362            if 1 > max_ordinal {
2363                return Ok(());
2364            }
2365
2366            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2367            // are envelope_size bytes.
2368            let cur_offset: usize = (1 - 1) * envelope_size;
2369
2370            // Zero reserved fields.
2371            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2372
2373            // Safety:
2374            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2375            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2376            //   envelope_size bytes, there is always sufficient room.
2377            fidl::encoding::encode_in_envelope_optional::<
2378                fidl::encoding::Endpoint<
2379                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2380                >,
2381                fidl::encoding::DefaultFuchsiaResourceDialect,
2382            >(
2383                self.outgoing_dir.as_mut().map(
2384                    <fidl::encoding::Endpoint<
2385                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2386                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2387                ),
2388                encoder,
2389                offset + cur_offset,
2390                depth,
2391            )?;
2392
2393            _prev_end_offset = cur_offset + envelope_size;
2394            if 2 > max_ordinal {
2395                return Ok(());
2396            }
2397
2398            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2399            // are envelope_size bytes.
2400            let cur_offset: usize = (2 - 1) * envelope_size;
2401
2402            // Zero reserved fields.
2403            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2404
2405            // Safety:
2406            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2407            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2408            //   envelope_size bytes, there is always sufficient room.
2409            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_component_sandbox::DictionaryRef, fidl::encoding::DefaultFuchsiaResourceDialect>(
2410            self.escrowed_dictionary.as_mut().map(<fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2411            encoder, offset + cur_offset, depth
2412        )?;
2413
2414            _prev_end_offset = cur_offset + envelope_size;
2415            if 3 > max_ordinal {
2416                return Ok(());
2417            }
2418
2419            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2420            // are envelope_size bytes.
2421            let cur_offset: usize = (3 - 1) * envelope_size;
2422
2423            // Zero reserved fields.
2424            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2425
2426            // Safety:
2427            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2428            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2429            //   envelope_size bytes, there is always sufficient room.
2430            fidl::encoding::encode_in_envelope_optional::<
2431                fidl::encoding::HandleType<
2432                    fidl::EventPair,
2433                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2434                    2147483648,
2435                >,
2436                fidl::encoding::DefaultFuchsiaResourceDialect,
2437            >(
2438                self.escrowed_dictionary_handle.as_mut().map(
2439                    <fidl::encoding::HandleType<
2440                        fidl::EventPair,
2441                        { fidl::ObjectType::EVENTPAIR.into_raw() },
2442                        2147483648,
2443                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2444                ),
2445                encoder,
2446                offset + cur_offset,
2447                depth,
2448            )?;
2449
2450            _prev_end_offset = cur_offset + envelope_size;
2451
2452            Ok(())
2453        }
2454    }
2455
2456    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2457        for ComponentControllerOnEscrowRequest
2458    {
2459        #[inline(always)]
2460        fn new_empty() -> Self {
2461            Self::default()
2462        }
2463
2464        unsafe fn decode(
2465            &mut self,
2466            decoder: &mut fidl::encoding::Decoder<
2467                '_,
2468                fidl::encoding::DefaultFuchsiaResourceDialect,
2469            >,
2470            offset: usize,
2471            mut depth: fidl::encoding::Depth,
2472        ) -> fidl::Result<()> {
2473            decoder.debug_check_bounds::<Self>(offset);
2474            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2475                None => return Err(fidl::Error::NotNullable),
2476                Some(len) => len,
2477            };
2478            // Calling decoder.out_of_line_offset(0) is not allowed.
2479            if len == 0 {
2480                return Ok(());
2481            };
2482            depth.increment()?;
2483            let envelope_size = 8;
2484            let bytes_len = len * envelope_size;
2485            let offset = decoder.out_of_line_offset(bytes_len)?;
2486            // Decode the envelope for each type.
2487            let mut _next_ordinal_to_read = 0;
2488            let mut next_offset = offset;
2489            let end_offset = offset + bytes_len;
2490            _next_ordinal_to_read += 1;
2491            if next_offset >= end_offset {
2492                return Ok(());
2493            }
2494
2495            // Decode unknown envelopes for gaps in ordinals.
2496            while _next_ordinal_to_read < 1 {
2497                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2498                _next_ordinal_to_read += 1;
2499                next_offset += envelope_size;
2500            }
2501
2502            let next_out_of_line = decoder.next_out_of_line();
2503            let handles_before = decoder.remaining_handles();
2504            if let Some((inlined, num_bytes, num_handles)) =
2505                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2506            {
2507                let member_inline_size = <fidl::encoding::Endpoint<
2508                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2509                > as fidl::encoding::TypeMarker>::inline_size(
2510                    decoder.context
2511                );
2512                if inlined != (member_inline_size <= 4) {
2513                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2514                }
2515                let inner_offset;
2516                let mut inner_depth = depth.clone();
2517                if inlined {
2518                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2519                    inner_offset = next_offset;
2520                } else {
2521                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2522                    inner_depth.increment()?;
2523                }
2524                let val_ref = self.outgoing_dir.get_or_insert_with(|| {
2525                    fidl::new_empty!(
2526                        fidl::encoding::Endpoint<
2527                            fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2528                        >,
2529                        fidl::encoding::DefaultFuchsiaResourceDialect
2530                    )
2531                });
2532                fidl::decode!(
2533                    fidl::encoding::Endpoint<
2534                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2535                    >,
2536                    fidl::encoding::DefaultFuchsiaResourceDialect,
2537                    val_ref,
2538                    decoder,
2539                    inner_offset,
2540                    inner_depth
2541                )?;
2542                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2543                {
2544                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2545                }
2546                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2547                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2548                }
2549            }
2550
2551            next_offset += envelope_size;
2552            _next_ordinal_to_read += 1;
2553            if next_offset >= end_offset {
2554                return Ok(());
2555            }
2556
2557            // Decode unknown envelopes for gaps in ordinals.
2558            while _next_ordinal_to_read < 2 {
2559                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2560                _next_ordinal_to_read += 1;
2561                next_offset += envelope_size;
2562            }
2563
2564            let next_out_of_line = decoder.next_out_of_line();
2565            let handles_before = decoder.remaining_handles();
2566            if let Some((inlined, num_bytes, num_handles)) =
2567                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2568            {
2569                let member_inline_size = <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2570                if inlined != (member_inline_size <= 4) {
2571                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2572                }
2573                let inner_offset;
2574                let mut inner_depth = depth.clone();
2575                if inlined {
2576                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2577                    inner_offset = next_offset;
2578                } else {
2579                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2580                    inner_depth.increment()?;
2581                }
2582                let val_ref = self.escrowed_dictionary.get_or_insert_with(|| {
2583                    fidl::new_empty!(
2584                        fidl_fuchsia_component_sandbox::DictionaryRef,
2585                        fidl::encoding::DefaultFuchsiaResourceDialect
2586                    )
2587                });
2588                fidl::decode!(
2589                    fidl_fuchsia_component_sandbox::DictionaryRef,
2590                    fidl::encoding::DefaultFuchsiaResourceDialect,
2591                    val_ref,
2592                    decoder,
2593                    inner_offset,
2594                    inner_depth
2595                )?;
2596                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2597                {
2598                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2599                }
2600                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2601                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2602                }
2603            }
2604
2605            next_offset += envelope_size;
2606            _next_ordinal_to_read += 1;
2607            if next_offset >= end_offset {
2608                return Ok(());
2609            }
2610
2611            // Decode unknown envelopes for gaps in ordinals.
2612            while _next_ordinal_to_read < 3 {
2613                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2614                _next_ordinal_to_read += 1;
2615                next_offset += envelope_size;
2616            }
2617
2618            let next_out_of_line = decoder.next_out_of_line();
2619            let handles_before = decoder.remaining_handles();
2620            if let Some((inlined, num_bytes, num_handles)) =
2621                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2622            {
2623                let member_inline_size = <fidl::encoding::HandleType<
2624                    fidl::EventPair,
2625                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2626                    2147483648,
2627                > as fidl::encoding::TypeMarker>::inline_size(
2628                    decoder.context
2629                );
2630                if inlined != (member_inline_size <= 4) {
2631                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2632                }
2633                let inner_offset;
2634                let mut inner_depth = depth.clone();
2635                if inlined {
2636                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2637                    inner_offset = next_offset;
2638                } else {
2639                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2640                    inner_depth.increment()?;
2641                }
2642                let val_ref =
2643                self.escrowed_dictionary_handle.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2644                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2645                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2646                {
2647                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2648                }
2649                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2650                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2651                }
2652            }
2653
2654            next_offset += envelope_size;
2655
2656            // Decode the remaining unknown envelopes.
2657            while next_offset < end_offset {
2658                _next_ordinal_to_read += 1;
2659                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2660                next_offset += envelope_size;
2661            }
2662
2663            Ok(())
2664        }
2665    }
2666
2667    impl ComponentDiagnostics {
2668        #[inline(always)]
2669        fn max_ordinal_present(&self) -> u64 {
2670            if let Some(_) = self.tasks {
2671                return 1;
2672            }
2673            0
2674        }
2675    }
2676
2677    impl fidl::encoding::ResourceTypeMarker for ComponentDiagnostics {
2678        type Borrowed<'a> = &'a mut Self;
2679        fn take_or_borrow<'a>(
2680            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2681        ) -> Self::Borrowed<'a> {
2682            value
2683        }
2684    }
2685
2686    unsafe impl fidl::encoding::TypeMarker for ComponentDiagnostics {
2687        type Owned = Self;
2688
2689        #[inline(always)]
2690        fn inline_align(_context: fidl::encoding::Context) -> usize {
2691            8
2692        }
2693
2694        #[inline(always)]
2695        fn inline_size(_context: fidl::encoding::Context) -> usize {
2696            16
2697        }
2698    }
2699
2700    unsafe impl
2701        fidl::encoding::Encode<ComponentDiagnostics, fidl::encoding::DefaultFuchsiaResourceDialect>
2702        for &mut ComponentDiagnostics
2703    {
2704        unsafe fn encode(
2705            self,
2706            encoder: &mut fidl::encoding::Encoder<
2707                '_,
2708                fidl::encoding::DefaultFuchsiaResourceDialect,
2709            >,
2710            offset: usize,
2711            mut depth: fidl::encoding::Depth,
2712        ) -> fidl::Result<()> {
2713            encoder.debug_check_bounds::<ComponentDiagnostics>(offset);
2714            // Vector header
2715            let max_ordinal: u64 = self.max_ordinal_present();
2716            encoder.write_num(max_ordinal, offset);
2717            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2718            // Calling encoder.out_of_line_offset(0) is not allowed.
2719            if max_ordinal == 0 {
2720                return Ok(());
2721            }
2722            depth.increment()?;
2723            let envelope_size = 8;
2724            let bytes_len = max_ordinal as usize * envelope_size;
2725            #[allow(unused_variables)]
2726            let offset = encoder.out_of_line_offset(bytes_len);
2727            let mut _prev_end_offset: usize = 0;
2728            if 1 > max_ordinal {
2729                return Ok(());
2730            }
2731
2732            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2733            // are envelope_size bytes.
2734            let cur_offset: usize = (1 - 1) * envelope_size;
2735
2736            // Zero reserved fields.
2737            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2738
2739            // Safety:
2740            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2741            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2742            //   envelope_size bytes, there is always sufficient room.
2743            fidl::encoding::encode_in_envelope_optional::<
2744                ComponentTasks,
2745                fidl::encoding::DefaultFuchsiaResourceDialect,
2746            >(
2747                self.tasks
2748                    .as_mut()
2749                    .map(<ComponentTasks as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2750                encoder,
2751                offset + cur_offset,
2752                depth,
2753            )?;
2754
2755            _prev_end_offset = cur_offset + envelope_size;
2756
2757            Ok(())
2758        }
2759    }
2760
2761    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2762        for ComponentDiagnostics
2763    {
2764        #[inline(always)]
2765        fn new_empty() -> Self {
2766            Self::default()
2767        }
2768
2769        unsafe fn decode(
2770            &mut self,
2771            decoder: &mut fidl::encoding::Decoder<
2772                '_,
2773                fidl::encoding::DefaultFuchsiaResourceDialect,
2774            >,
2775            offset: usize,
2776            mut depth: fidl::encoding::Depth,
2777        ) -> fidl::Result<()> {
2778            decoder.debug_check_bounds::<Self>(offset);
2779            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2780                None => return Err(fidl::Error::NotNullable),
2781                Some(len) => len,
2782            };
2783            // Calling decoder.out_of_line_offset(0) is not allowed.
2784            if len == 0 {
2785                return Ok(());
2786            };
2787            depth.increment()?;
2788            let envelope_size = 8;
2789            let bytes_len = len * envelope_size;
2790            let offset = decoder.out_of_line_offset(bytes_len)?;
2791            // Decode the envelope for each type.
2792            let mut _next_ordinal_to_read = 0;
2793            let mut next_offset = offset;
2794            let end_offset = offset + bytes_len;
2795            _next_ordinal_to_read += 1;
2796            if next_offset >= end_offset {
2797                return Ok(());
2798            }
2799
2800            // Decode unknown envelopes for gaps in ordinals.
2801            while _next_ordinal_to_read < 1 {
2802                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2803                _next_ordinal_to_read += 1;
2804                next_offset += envelope_size;
2805            }
2806
2807            let next_out_of_line = decoder.next_out_of_line();
2808            let handles_before = decoder.remaining_handles();
2809            if let Some((inlined, num_bytes, num_handles)) =
2810                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2811            {
2812                let member_inline_size =
2813                    <ComponentTasks as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2814                if inlined != (member_inline_size <= 4) {
2815                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2816                }
2817                let inner_offset;
2818                let mut inner_depth = depth.clone();
2819                if inlined {
2820                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2821                    inner_offset = next_offset;
2822                } else {
2823                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2824                    inner_depth.increment()?;
2825                }
2826                let val_ref = self.tasks.get_or_insert_with(|| {
2827                    fidl::new_empty!(ComponentTasks, fidl::encoding::DefaultFuchsiaResourceDialect)
2828                });
2829                fidl::decode!(
2830                    ComponentTasks,
2831                    fidl::encoding::DefaultFuchsiaResourceDialect,
2832                    val_ref,
2833                    decoder,
2834                    inner_offset,
2835                    inner_depth
2836                )?;
2837                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2838                {
2839                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2840                }
2841                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2842                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2843                }
2844            }
2845
2846            next_offset += envelope_size;
2847
2848            // Decode the remaining unknown envelopes.
2849            while next_offset < end_offset {
2850                _next_ordinal_to_read += 1;
2851                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2852                next_offset += envelope_size;
2853            }
2854
2855            Ok(())
2856        }
2857    }
2858
2859    impl ComponentNamespaceEntry {
2860        #[inline(always)]
2861        fn max_ordinal_present(&self) -> u64 {
2862            if let Some(_) = self.directory {
2863                return 2;
2864            }
2865            if let Some(_) = self.path {
2866                return 1;
2867            }
2868            0
2869        }
2870    }
2871
2872    impl fidl::encoding::ResourceTypeMarker for ComponentNamespaceEntry {
2873        type Borrowed<'a> = &'a mut Self;
2874        fn take_or_borrow<'a>(
2875            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2876        ) -> Self::Borrowed<'a> {
2877            value
2878        }
2879    }
2880
2881    unsafe impl fidl::encoding::TypeMarker for ComponentNamespaceEntry {
2882        type Owned = Self;
2883
2884        #[inline(always)]
2885        fn inline_align(_context: fidl::encoding::Context) -> usize {
2886            8
2887        }
2888
2889        #[inline(always)]
2890        fn inline_size(_context: fidl::encoding::Context) -> usize {
2891            16
2892        }
2893    }
2894
2895    unsafe impl
2896        fidl::encoding::Encode<
2897            ComponentNamespaceEntry,
2898            fidl::encoding::DefaultFuchsiaResourceDialect,
2899        > for &mut ComponentNamespaceEntry
2900    {
2901        unsafe fn encode(
2902            self,
2903            encoder: &mut fidl::encoding::Encoder<
2904                '_,
2905                fidl::encoding::DefaultFuchsiaResourceDialect,
2906            >,
2907            offset: usize,
2908            mut depth: fidl::encoding::Depth,
2909        ) -> fidl::Result<()> {
2910            encoder.debug_check_bounds::<ComponentNamespaceEntry>(offset);
2911            // Vector header
2912            let max_ordinal: u64 = self.max_ordinal_present();
2913            encoder.write_num(max_ordinal, offset);
2914            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2915            // Calling encoder.out_of_line_offset(0) is not allowed.
2916            if max_ordinal == 0 {
2917                return Ok(());
2918            }
2919            depth.increment()?;
2920            let envelope_size = 8;
2921            let bytes_len = max_ordinal as usize * envelope_size;
2922            #[allow(unused_variables)]
2923            let offset = encoder.out_of_line_offset(bytes_len);
2924            let mut _prev_end_offset: usize = 0;
2925            if 1 > max_ordinal {
2926                return Ok(());
2927            }
2928
2929            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2930            // are envelope_size bytes.
2931            let cur_offset: usize = (1 - 1) * envelope_size;
2932
2933            // Zero reserved fields.
2934            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2935
2936            // Safety:
2937            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2938            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2939            //   envelope_size bytes, there is always sufficient room.
2940            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4095>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2941            self.path.as_ref().map(<fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow),
2942            encoder, offset + cur_offset, depth
2943        )?;
2944
2945            _prev_end_offset = cur_offset + envelope_size;
2946            if 2 > max_ordinal {
2947                return Ok(());
2948            }
2949
2950            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2951            // are envelope_size bytes.
2952            let cur_offset: usize = (2 - 1) * envelope_size;
2953
2954            // Zero reserved fields.
2955            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2956
2957            // Safety:
2958            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2959            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2960            //   envelope_size bytes, there is always sufficient room.
2961            fidl::encoding::encode_in_envelope_optional::<
2962                fidl::encoding::Endpoint<
2963                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2964                >,
2965                fidl::encoding::DefaultFuchsiaResourceDialect,
2966            >(
2967                self.directory.as_mut().map(
2968                    <fidl::encoding::Endpoint<
2969                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2970                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2971                ),
2972                encoder,
2973                offset + cur_offset,
2974                depth,
2975            )?;
2976
2977            _prev_end_offset = cur_offset + envelope_size;
2978
2979            Ok(())
2980        }
2981    }
2982
2983    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2984        for ComponentNamespaceEntry
2985    {
2986        #[inline(always)]
2987        fn new_empty() -> Self {
2988            Self::default()
2989        }
2990
2991        unsafe fn decode(
2992            &mut self,
2993            decoder: &mut fidl::encoding::Decoder<
2994                '_,
2995                fidl::encoding::DefaultFuchsiaResourceDialect,
2996            >,
2997            offset: usize,
2998            mut depth: fidl::encoding::Depth,
2999        ) -> fidl::Result<()> {
3000            decoder.debug_check_bounds::<Self>(offset);
3001            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3002                None => return Err(fidl::Error::NotNullable),
3003                Some(len) => len,
3004            };
3005            // Calling decoder.out_of_line_offset(0) is not allowed.
3006            if len == 0 {
3007                return Ok(());
3008            };
3009            depth.increment()?;
3010            let envelope_size = 8;
3011            let bytes_len = len * envelope_size;
3012            let offset = decoder.out_of_line_offset(bytes_len)?;
3013            // Decode the envelope for each type.
3014            let mut _next_ordinal_to_read = 0;
3015            let mut next_offset = offset;
3016            let end_offset = offset + bytes_len;
3017            _next_ordinal_to_read += 1;
3018            if next_offset >= end_offset {
3019                return Ok(());
3020            }
3021
3022            // Decode unknown envelopes for gaps in ordinals.
3023            while _next_ordinal_to_read < 1 {
3024                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3025                _next_ordinal_to_read += 1;
3026                next_offset += envelope_size;
3027            }
3028
3029            let next_out_of_line = decoder.next_out_of_line();
3030            let handles_before = decoder.remaining_handles();
3031            if let Some((inlined, num_bytes, num_handles)) =
3032                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3033            {
3034                let member_inline_size = <fidl::encoding::BoundedString<4095> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3035                if inlined != (member_inline_size <= 4) {
3036                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3037                }
3038                let inner_offset;
3039                let mut inner_depth = depth.clone();
3040                if inlined {
3041                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3042                    inner_offset = next_offset;
3043                } else {
3044                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3045                    inner_depth.increment()?;
3046                }
3047                let val_ref = self.path.get_or_insert_with(|| {
3048                    fidl::new_empty!(
3049                        fidl::encoding::BoundedString<4095>,
3050                        fidl::encoding::DefaultFuchsiaResourceDialect
3051                    )
3052                });
3053                fidl::decode!(
3054                    fidl::encoding::BoundedString<4095>,
3055                    fidl::encoding::DefaultFuchsiaResourceDialect,
3056                    val_ref,
3057                    decoder,
3058                    inner_offset,
3059                    inner_depth
3060                )?;
3061                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3062                {
3063                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3064                }
3065                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3066                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3067                }
3068            }
3069
3070            next_offset += envelope_size;
3071            _next_ordinal_to_read += 1;
3072            if next_offset >= end_offset {
3073                return Ok(());
3074            }
3075
3076            // Decode unknown envelopes for gaps in ordinals.
3077            while _next_ordinal_to_read < 2 {
3078                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3079                _next_ordinal_to_read += 1;
3080                next_offset += envelope_size;
3081            }
3082
3083            let next_out_of_line = decoder.next_out_of_line();
3084            let handles_before = decoder.remaining_handles();
3085            if let Some((inlined, num_bytes, num_handles)) =
3086                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3087            {
3088                let member_inline_size = <fidl::encoding::Endpoint<
3089                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3090                > as fidl::encoding::TypeMarker>::inline_size(
3091                    decoder.context
3092                );
3093                if inlined != (member_inline_size <= 4) {
3094                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3095                }
3096                let inner_offset;
3097                let mut inner_depth = depth.clone();
3098                if inlined {
3099                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3100                    inner_offset = next_offset;
3101                } else {
3102                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3103                    inner_depth.increment()?;
3104                }
3105                let val_ref = self.directory.get_or_insert_with(|| {
3106                    fidl::new_empty!(
3107                        fidl::encoding::Endpoint<
3108                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3109                        >,
3110                        fidl::encoding::DefaultFuchsiaResourceDialect
3111                    )
3112                });
3113                fidl::decode!(
3114                    fidl::encoding::Endpoint<
3115                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3116                    >,
3117                    fidl::encoding::DefaultFuchsiaResourceDialect,
3118                    val_ref,
3119                    decoder,
3120                    inner_offset,
3121                    inner_depth
3122                )?;
3123                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3124                {
3125                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3126                }
3127                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3128                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3129                }
3130            }
3131
3132            next_offset += envelope_size;
3133
3134            // Decode the remaining unknown envelopes.
3135            while next_offset < end_offset {
3136                _next_ordinal_to_read += 1;
3137                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3138                next_offset += envelope_size;
3139            }
3140
3141            Ok(())
3142        }
3143    }
3144
3145    impl ComponentStartInfo {
3146        #[inline(always)]
3147        fn max_ordinal_present(&self) -> u64 {
3148            if let Some(_) = self.escrowed_dictionary_handle {
3149                return 11;
3150            }
3151            if let Some(_) = self.escrowed_dictionary {
3152                return 10;
3153            }
3154            if let Some(_) = self.component_instance {
3155                return 9;
3156            }
3157            if let Some(_) = self.break_on_start {
3158                return 8;
3159            }
3160            if let Some(_) = self.encoded_config {
3161                return 7;
3162            }
3163            if let Some(_) = self.numbered_handles {
3164                return 6;
3165            }
3166            if let Some(_) = self.runtime_dir {
3167                return 5;
3168            }
3169            if let Some(_) = self.outgoing_dir {
3170                return 4;
3171            }
3172            if let Some(_) = self.ns {
3173                return 3;
3174            }
3175            if let Some(_) = self.program {
3176                return 2;
3177            }
3178            if let Some(_) = self.resolved_url {
3179                return 1;
3180            }
3181            0
3182        }
3183    }
3184
3185    impl fidl::encoding::ResourceTypeMarker for ComponentStartInfo {
3186        type Borrowed<'a> = &'a mut Self;
3187        fn take_or_borrow<'a>(
3188            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3189        ) -> Self::Borrowed<'a> {
3190            value
3191        }
3192    }
3193
3194    unsafe impl fidl::encoding::TypeMarker for ComponentStartInfo {
3195        type Owned = Self;
3196
3197        #[inline(always)]
3198        fn inline_align(_context: fidl::encoding::Context) -> usize {
3199            8
3200        }
3201
3202        #[inline(always)]
3203        fn inline_size(_context: fidl::encoding::Context) -> usize {
3204            16
3205        }
3206    }
3207
3208    unsafe impl
3209        fidl::encoding::Encode<ComponentStartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
3210        for &mut ComponentStartInfo
3211    {
3212        unsafe fn encode(
3213            self,
3214            encoder: &mut fidl::encoding::Encoder<
3215                '_,
3216                fidl::encoding::DefaultFuchsiaResourceDialect,
3217            >,
3218            offset: usize,
3219            mut depth: fidl::encoding::Depth,
3220        ) -> fidl::Result<()> {
3221            encoder.debug_check_bounds::<ComponentStartInfo>(offset);
3222            // Vector header
3223            let max_ordinal: u64 = self.max_ordinal_present();
3224            encoder.write_num(max_ordinal, offset);
3225            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3226            // Calling encoder.out_of_line_offset(0) is not allowed.
3227            if max_ordinal == 0 {
3228                return Ok(());
3229            }
3230            depth.increment()?;
3231            let envelope_size = 8;
3232            let bytes_len = max_ordinal as usize * envelope_size;
3233            #[allow(unused_variables)]
3234            let offset = encoder.out_of_line_offset(bytes_len);
3235            let mut _prev_end_offset: usize = 0;
3236            if 1 > max_ordinal {
3237                return Ok(());
3238            }
3239
3240            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3241            // are envelope_size bytes.
3242            let cur_offset: usize = (1 - 1) * envelope_size;
3243
3244            // Zero reserved fields.
3245            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3246
3247            // Safety:
3248            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3249            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3250            //   envelope_size bytes, there is always sufficient room.
3251            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3252            self.resolved_url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
3253            encoder, offset + cur_offset, depth
3254        )?;
3255
3256            _prev_end_offset = cur_offset + envelope_size;
3257            if 2 > max_ordinal {
3258                return Ok(());
3259            }
3260
3261            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3262            // are envelope_size bytes.
3263            let cur_offset: usize = (2 - 1) * envelope_size;
3264
3265            // Zero reserved fields.
3266            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3267
3268            // Safety:
3269            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3270            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3271            //   envelope_size bytes, there is always sufficient room.
3272            fidl::encoding::encode_in_envelope_optional::<
3273                fidl_fuchsia_data::Dictionary,
3274                fidl::encoding::DefaultFuchsiaResourceDialect,
3275            >(
3276                self.program.as_ref().map(
3277                    <fidl_fuchsia_data::Dictionary as fidl::encoding::ValueTypeMarker>::borrow,
3278                ),
3279                encoder,
3280                offset + cur_offset,
3281                depth,
3282            )?;
3283
3284            _prev_end_offset = cur_offset + envelope_size;
3285            if 3 > max_ordinal {
3286                return Ok(());
3287            }
3288
3289            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3290            // are envelope_size bytes.
3291            let cur_offset: usize = (3 - 1) * envelope_size;
3292
3293            // Zero reserved fields.
3294            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3295
3296            // Safety:
3297            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3298            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3299            //   envelope_size bytes, there is always sufficient room.
3300            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ComponentNamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3301            self.ns.as_mut().map(<fidl::encoding::Vector<ComponentNamespaceEntry, 32> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3302            encoder, offset + cur_offset, depth
3303        )?;
3304
3305            _prev_end_offset = cur_offset + envelope_size;
3306            if 4 > max_ordinal {
3307                return Ok(());
3308            }
3309
3310            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3311            // are envelope_size bytes.
3312            let cur_offset: usize = (4 - 1) * envelope_size;
3313
3314            // Zero reserved fields.
3315            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3316
3317            // Safety:
3318            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3319            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3320            //   envelope_size bytes, there is always sufficient room.
3321            fidl::encoding::encode_in_envelope_optional::<
3322                fidl::encoding::Endpoint<
3323                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3324                >,
3325                fidl::encoding::DefaultFuchsiaResourceDialect,
3326            >(
3327                self.outgoing_dir.as_mut().map(
3328                    <fidl::encoding::Endpoint<
3329                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3330                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3331                ),
3332                encoder,
3333                offset + cur_offset,
3334                depth,
3335            )?;
3336
3337            _prev_end_offset = cur_offset + envelope_size;
3338            if 5 > max_ordinal {
3339                return Ok(());
3340            }
3341
3342            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3343            // are envelope_size bytes.
3344            let cur_offset: usize = (5 - 1) * envelope_size;
3345
3346            // Zero reserved fields.
3347            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3348
3349            // Safety:
3350            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3351            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3352            //   envelope_size bytes, there is always sufficient room.
3353            fidl::encoding::encode_in_envelope_optional::<
3354                fidl::encoding::Endpoint<
3355                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3356                >,
3357                fidl::encoding::DefaultFuchsiaResourceDialect,
3358            >(
3359                self.runtime_dir.as_mut().map(
3360                    <fidl::encoding::Endpoint<
3361                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3362                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3363                ),
3364                encoder,
3365                offset + cur_offset,
3366                depth,
3367            )?;
3368
3369            _prev_end_offset = cur_offset + envelope_size;
3370            if 6 > max_ordinal {
3371                return Ok(());
3372            }
3373
3374            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3375            // are envelope_size bytes.
3376            let cur_offset: usize = (6 - 1) * envelope_size;
3377
3378            // Zero reserved fields.
3379            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3380
3381            // Safety:
3382            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3383            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3384            //   envelope_size bytes, there is always sufficient room.
3385            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3386            self.numbered_handles.as_mut().map(<fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3387            encoder, offset + cur_offset, depth
3388        )?;
3389
3390            _prev_end_offset = cur_offset + envelope_size;
3391            if 7 > max_ordinal {
3392                return Ok(());
3393            }
3394
3395            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3396            // are envelope_size bytes.
3397            let cur_offset: usize = (7 - 1) * envelope_size;
3398
3399            // Zero reserved fields.
3400            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3401
3402            // Safety:
3403            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3404            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3405            //   envelope_size bytes, there is always sufficient room.
3406            fidl::encoding::encode_in_envelope_optional::<
3407                fidl_fuchsia_mem::Data,
3408                fidl::encoding::DefaultFuchsiaResourceDialect,
3409            >(
3410                self.encoded_config.as_mut().map(
3411                    <fidl_fuchsia_mem::Data as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3412                ),
3413                encoder,
3414                offset + cur_offset,
3415                depth,
3416            )?;
3417
3418            _prev_end_offset = cur_offset + envelope_size;
3419            if 8 > max_ordinal {
3420                return Ok(());
3421            }
3422
3423            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3424            // are envelope_size bytes.
3425            let cur_offset: usize = (8 - 1) * envelope_size;
3426
3427            // Zero reserved fields.
3428            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3429
3430            // Safety:
3431            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3432            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3433            //   envelope_size bytes, there is always sufficient room.
3434            fidl::encoding::encode_in_envelope_optional::<
3435                fidl::encoding::HandleType<
3436                    fidl::EventPair,
3437                    { fidl::ObjectType::EVENTPAIR.into_raw() },
3438                    2147483648,
3439                >,
3440                fidl::encoding::DefaultFuchsiaResourceDialect,
3441            >(
3442                self.break_on_start.as_mut().map(
3443                    <fidl::encoding::HandleType<
3444                        fidl::EventPair,
3445                        { fidl::ObjectType::EVENTPAIR.into_raw() },
3446                        2147483648,
3447                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3448                ),
3449                encoder,
3450                offset + cur_offset,
3451                depth,
3452            )?;
3453
3454            _prev_end_offset = cur_offset + envelope_size;
3455            if 9 > max_ordinal {
3456                return Ok(());
3457            }
3458
3459            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3460            // are envelope_size bytes.
3461            let cur_offset: usize = (9 - 1) * envelope_size;
3462
3463            // Zero reserved fields.
3464            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3465
3466            // Safety:
3467            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3468            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3469            //   envelope_size bytes, there is always sufficient room.
3470            fidl::encoding::encode_in_envelope_optional::<
3471                fidl::encoding::HandleType<
3472                    fidl::Event,
3473                    { fidl::ObjectType::EVENT.into_raw() },
3474                    2147483648,
3475                >,
3476                fidl::encoding::DefaultFuchsiaResourceDialect,
3477            >(
3478                self.component_instance.as_mut().map(
3479                    <fidl::encoding::HandleType<
3480                        fidl::Event,
3481                        { fidl::ObjectType::EVENT.into_raw() },
3482                        2147483648,
3483                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3484                ),
3485                encoder,
3486                offset + cur_offset,
3487                depth,
3488            )?;
3489
3490            _prev_end_offset = cur_offset + envelope_size;
3491            if 10 > max_ordinal {
3492                return Ok(());
3493            }
3494
3495            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3496            // are envelope_size bytes.
3497            let cur_offset: usize = (10 - 1) * envelope_size;
3498
3499            // Zero reserved fields.
3500            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3501
3502            // Safety:
3503            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3504            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3505            //   envelope_size bytes, there is always sufficient room.
3506            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_component_sandbox::DictionaryRef, fidl::encoding::DefaultFuchsiaResourceDialect>(
3507            self.escrowed_dictionary.as_mut().map(<fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3508            encoder, offset + cur_offset, depth
3509        )?;
3510
3511            _prev_end_offset = cur_offset + envelope_size;
3512            if 11 > max_ordinal {
3513                return Ok(());
3514            }
3515
3516            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3517            // are envelope_size bytes.
3518            let cur_offset: usize = (11 - 1) * envelope_size;
3519
3520            // Zero reserved fields.
3521            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3522
3523            // Safety:
3524            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3525            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3526            //   envelope_size bytes, there is always sufficient room.
3527            fidl::encoding::encode_in_envelope_optional::<
3528                fidl::encoding::HandleType<
3529                    fidl::EventPair,
3530                    { fidl::ObjectType::EVENTPAIR.into_raw() },
3531                    2147483648,
3532                >,
3533                fidl::encoding::DefaultFuchsiaResourceDialect,
3534            >(
3535                self.escrowed_dictionary_handle.as_mut().map(
3536                    <fidl::encoding::HandleType<
3537                        fidl::EventPair,
3538                        { fidl::ObjectType::EVENTPAIR.into_raw() },
3539                        2147483648,
3540                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3541                ),
3542                encoder,
3543                offset + cur_offset,
3544                depth,
3545            )?;
3546
3547            _prev_end_offset = cur_offset + envelope_size;
3548
3549            Ok(())
3550        }
3551    }
3552
3553    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3554        for ComponentStartInfo
3555    {
3556        #[inline(always)]
3557        fn new_empty() -> Self {
3558            Self::default()
3559        }
3560
3561        unsafe fn decode(
3562            &mut self,
3563            decoder: &mut fidl::encoding::Decoder<
3564                '_,
3565                fidl::encoding::DefaultFuchsiaResourceDialect,
3566            >,
3567            offset: usize,
3568            mut depth: fidl::encoding::Depth,
3569        ) -> fidl::Result<()> {
3570            decoder.debug_check_bounds::<Self>(offset);
3571            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3572                None => return Err(fidl::Error::NotNullable),
3573                Some(len) => len,
3574            };
3575            // Calling decoder.out_of_line_offset(0) is not allowed.
3576            if len == 0 {
3577                return Ok(());
3578            };
3579            depth.increment()?;
3580            let envelope_size = 8;
3581            let bytes_len = len * envelope_size;
3582            let offset = decoder.out_of_line_offset(bytes_len)?;
3583            // Decode the envelope for each type.
3584            let mut _next_ordinal_to_read = 0;
3585            let mut next_offset = offset;
3586            let end_offset = offset + bytes_len;
3587            _next_ordinal_to_read += 1;
3588            if next_offset >= end_offset {
3589                return Ok(());
3590            }
3591
3592            // Decode unknown envelopes for gaps in ordinals.
3593            while _next_ordinal_to_read < 1 {
3594                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3595                _next_ordinal_to_read += 1;
3596                next_offset += envelope_size;
3597            }
3598
3599            let next_out_of_line = decoder.next_out_of_line();
3600            let handles_before = decoder.remaining_handles();
3601            if let Some((inlined, num_bytes, num_handles)) =
3602                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3603            {
3604                let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3605                if inlined != (member_inline_size <= 4) {
3606                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3607                }
3608                let inner_offset;
3609                let mut inner_depth = depth.clone();
3610                if inlined {
3611                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3612                    inner_offset = next_offset;
3613                } else {
3614                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3615                    inner_depth.increment()?;
3616                }
3617                let val_ref = self.resolved_url.get_or_insert_with(|| {
3618                    fidl::new_empty!(
3619                        fidl::encoding::BoundedString<4096>,
3620                        fidl::encoding::DefaultFuchsiaResourceDialect
3621                    )
3622                });
3623                fidl::decode!(
3624                    fidl::encoding::BoundedString<4096>,
3625                    fidl::encoding::DefaultFuchsiaResourceDialect,
3626                    val_ref,
3627                    decoder,
3628                    inner_offset,
3629                    inner_depth
3630                )?;
3631                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3632                {
3633                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3634                }
3635                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3636                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3637                }
3638            }
3639
3640            next_offset += envelope_size;
3641            _next_ordinal_to_read += 1;
3642            if next_offset >= end_offset {
3643                return Ok(());
3644            }
3645
3646            // Decode unknown envelopes for gaps in ordinals.
3647            while _next_ordinal_to_read < 2 {
3648                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3649                _next_ordinal_to_read += 1;
3650                next_offset += envelope_size;
3651            }
3652
3653            let next_out_of_line = decoder.next_out_of_line();
3654            let handles_before = decoder.remaining_handles();
3655            if let Some((inlined, num_bytes, num_handles)) =
3656                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3657            {
3658                let member_inline_size =
3659                    <fidl_fuchsia_data::Dictionary as fidl::encoding::TypeMarker>::inline_size(
3660                        decoder.context,
3661                    );
3662                if inlined != (member_inline_size <= 4) {
3663                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3664                }
3665                let inner_offset;
3666                let mut inner_depth = depth.clone();
3667                if inlined {
3668                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3669                    inner_offset = next_offset;
3670                } else {
3671                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3672                    inner_depth.increment()?;
3673                }
3674                let val_ref = self.program.get_or_insert_with(|| {
3675                    fidl::new_empty!(
3676                        fidl_fuchsia_data::Dictionary,
3677                        fidl::encoding::DefaultFuchsiaResourceDialect
3678                    )
3679                });
3680                fidl::decode!(
3681                    fidl_fuchsia_data::Dictionary,
3682                    fidl::encoding::DefaultFuchsiaResourceDialect,
3683                    val_ref,
3684                    decoder,
3685                    inner_offset,
3686                    inner_depth
3687                )?;
3688                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3689                {
3690                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3691                }
3692                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3693                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3694                }
3695            }
3696
3697            next_offset += envelope_size;
3698            _next_ordinal_to_read += 1;
3699            if next_offset >= end_offset {
3700                return Ok(());
3701            }
3702
3703            // Decode unknown envelopes for gaps in ordinals.
3704            while _next_ordinal_to_read < 3 {
3705                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3706                _next_ordinal_to_read += 1;
3707                next_offset += envelope_size;
3708            }
3709
3710            let next_out_of_line = decoder.next_out_of_line();
3711            let handles_before = decoder.remaining_handles();
3712            if let Some((inlined, num_bytes, num_handles)) =
3713                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3714            {
3715                let member_inline_size = <fidl::encoding::Vector<ComponentNamespaceEntry, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3716                if inlined != (member_inline_size <= 4) {
3717                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3718                }
3719                let inner_offset;
3720                let mut inner_depth = depth.clone();
3721                if inlined {
3722                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3723                    inner_offset = next_offset;
3724                } else {
3725                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3726                    inner_depth.increment()?;
3727                }
3728                let val_ref =
3729                self.ns.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<ComponentNamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
3730                fidl::decode!(fidl::encoding::Vector<ComponentNamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3731                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3732                {
3733                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3734                }
3735                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3736                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3737                }
3738            }
3739
3740            next_offset += envelope_size;
3741            _next_ordinal_to_read += 1;
3742            if next_offset >= end_offset {
3743                return Ok(());
3744            }
3745
3746            // Decode unknown envelopes for gaps in ordinals.
3747            while _next_ordinal_to_read < 4 {
3748                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3749                _next_ordinal_to_read += 1;
3750                next_offset += envelope_size;
3751            }
3752
3753            let next_out_of_line = decoder.next_out_of_line();
3754            let handles_before = decoder.remaining_handles();
3755            if let Some((inlined, num_bytes, num_handles)) =
3756                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3757            {
3758                let member_inline_size = <fidl::encoding::Endpoint<
3759                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3760                > as fidl::encoding::TypeMarker>::inline_size(
3761                    decoder.context
3762                );
3763                if inlined != (member_inline_size <= 4) {
3764                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3765                }
3766                let inner_offset;
3767                let mut inner_depth = depth.clone();
3768                if inlined {
3769                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3770                    inner_offset = next_offset;
3771                } else {
3772                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3773                    inner_depth.increment()?;
3774                }
3775                let val_ref = self.outgoing_dir.get_or_insert_with(|| {
3776                    fidl::new_empty!(
3777                        fidl::encoding::Endpoint<
3778                            fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3779                        >,
3780                        fidl::encoding::DefaultFuchsiaResourceDialect
3781                    )
3782                });
3783                fidl::decode!(
3784                    fidl::encoding::Endpoint<
3785                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3786                    >,
3787                    fidl::encoding::DefaultFuchsiaResourceDialect,
3788                    val_ref,
3789                    decoder,
3790                    inner_offset,
3791                    inner_depth
3792                )?;
3793                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3794                {
3795                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3796                }
3797                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3798                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3799                }
3800            }
3801
3802            next_offset += envelope_size;
3803            _next_ordinal_to_read += 1;
3804            if next_offset >= end_offset {
3805                return Ok(());
3806            }
3807
3808            // Decode unknown envelopes for gaps in ordinals.
3809            while _next_ordinal_to_read < 5 {
3810                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3811                _next_ordinal_to_read += 1;
3812                next_offset += envelope_size;
3813            }
3814
3815            let next_out_of_line = decoder.next_out_of_line();
3816            let handles_before = decoder.remaining_handles();
3817            if let Some((inlined, num_bytes, num_handles)) =
3818                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3819            {
3820                let member_inline_size = <fidl::encoding::Endpoint<
3821                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3822                > as fidl::encoding::TypeMarker>::inline_size(
3823                    decoder.context
3824                );
3825                if inlined != (member_inline_size <= 4) {
3826                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3827                }
3828                let inner_offset;
3829                let mut inner_depth = depth.clone();
3830                if inlined {
3831                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3832                    inner_offset = next_offset;
3833                } else {
3834                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3835                    inner_depth.increment()?;
3836                }
3837                let val_ref = self.runtime_dir.get_or_insert_with(|| {
3838                    fidl::new_empty!(
3839                        fidl::encoding::Endpoint<
3840                            fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3841                        >,
3842                        fidl::encoding::DefaultFuchsiaResourceDialect
3843                    )
3844                });
3845                fidl::decode!(
3846                    fidl::encoding::Endpoint<
3847                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3848                    >,
3849                    fidl::encoding::DefaultFuchsiaResourceDialect,
3850                    val_ref,
3851                    decoder,
3852                    inner_offset,
3853                    inner_depth
3854                )?;
3855                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3856                {
3857                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3858                }
3859                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3860                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3861                }
3862            }
3863
3864            next_offset += envelope_size;
3865            _next_ordinal_to_read += 1;
3866            if next_offset >= end_offset {
3867                return Ok(());
3868            }
3869
3870            // Decode unknown envelopes for gaps in ordinals.
3871            while _next_ordinal_to_read < 6 {
3872                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3873                _next_ordinal_to_read += 1;
3874                next_offset += envelope_size;
3875            }
3876
3877            let next_out_of_line = decoder.next_out_of_line();
3878            let handles_before = decoder.remaining_handles();
3879            if let Some((inlined, num_bytes, num_handles)) =
3880                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3881            {
3882                let member_inline_size = <fidl::encoding::Vector<
3883                    fidl_fuchsia_process::HandleInfo,
3884                    128,
3885                > as fidl::encoding::TypeMarker>::inline_size(
3886                    decoder.context
3887                );
3888                if inlined != (member_inline_size <= 4) {
3889                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3890                }
3891                let inner_offset;
3892                let mut inner_depth = depth.clone();
3893                if inlined {
3894                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3895                    inner_offset = next_offset;
3896                } else {
3897                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3898                    inner_depth.increment()?;
3899                }
3900                let val_ref =
3901                self.numbered_handles.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
3902                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3903                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3904                {
3905                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3906                }
3907                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3908                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3909                }
3910            }
3911
3912            next_offset += envelope_size;
3913            _next_ordinal_to_read += 1;
3914            if next_offset >= end_offset {
3915                return Ok(());
3916            }
3917
3918            // Decode unknown envelopes for gaps in ordinals.
3919            while _next_ordinal_to_read < 7 {
3920                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3921                _next_ordinal_to_read += 1;
3922                next_offset += envelope_size;
3923            }
3924
3925            let next_out_of_line = decoder.next_out_of_line();
3926            let handles_before = decoder.remaining_handles();
3927            if let Some((inlined, num_bytes, num_handles)) =
3928                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3929            {
3930                let member_inline_size =
3931                    <fidl_fuchsia_mem::Data as fidl::encoding::TypeMarker>::inline_size(
3932                        decoder.context,
3933                    );
3934                if inlined != (member_inline_size <= 4) {
3935                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3936                }
3937                let inner_offset;
3938                let mut inner_depth = depth.clone();
3939                if inlined {
3940                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3941                    inner_offset = next_offset;
3942                } else {
3943                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3944                    inner_depth.increment()?;
3945                }
3946                let val_ref = self.encoded_config.get_or_insert_with(|| {
3947                    fidl::new_empty!(
3948                        fidl_fuchsia_mem::Data,
3949                        fidl::encoding::DefaultFuchsiaResourceDialect
3950                    )
3951                });
3952                fidl::decode!(
3953                    fidl_fuchsia_mem::Data,
3954                    fidl::encoding::DefaultFuchsiaResourceDialect,
3955                    val_ref,
3956                    decoder,
3957                    inner_offset,
3958                    inner_depth
3959                )?;
3960                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3961                {
3962                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3963                }
3964                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3965                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3966                }
3967            }
3968
3969            next_offset += envelope_size;
3970            _next_ordinal_to_read += 1;
3971            if next_offset >= end_offset {
3972                return Ok(());
3973            }
3974
3975            // Decode unknown envelopes for gaps in ordinals.
3976            while _next_ordinal_to_read < 8 {
3977                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3978                _next_ordinal_to_read += 1;
3979                next_offset += envelope_size;
3980            }
3981
3982            let next_out_of_line = decoder.next_out_of_line();
3983            let handles_before = decoder.remaining_handles();
3984            if let Some((inlined, num_bytes, num_handles)) =
3985                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3986            {
3987                let member_inline_size = <fidl::encoding::HandleType<
3988                    fidl::EventPair,
3989                    { fidl::ObjectType::EVENTPAIR.into_raw() },
3990                    2147483648,
3991                > as fidl::encoding::TypeMarker>::inline_size(
3992                    decoder.context
3993                );
3994                if inlined != (member_inline_size <= 4) {
3995                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3996                }
3997                let inner_offset;
3998                let mut inner_depth = depth.clone();
3999                if inlined {
4000                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4001                    inner_offset = next_offset;
4002                } else {
4003                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4004                    inner_depth.increment()?;
4005                }
4006                let val_ref =
4007                self.break_on_start.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
4008                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4009                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4010                {
4011                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4012                }
4013                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4014                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4015                }
4016            }
4017
4018            next_offset += envelope_size;
4019            _next_ordinal_to_read += 1;
4020            if next_offset >= end_offset {
4021                return Ok(());
4022            }
4023
4024            // Decode unknown envelopes for gaps in ordinals.
4025            while _next_ordinal_to_read < 9 {
4026                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4027                _next_ordinal_to_read += 1;
4028                next_offset += envelope_size;
4029            }
4030
4031            let next_out_of_line = decoder.next_out_of_line();
4032            let handles_before = decoder.remaining_handles();
4033            if let Some((inlined, num_bytes, num_handles)) =
4034                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4035            {
4036                let member_inline_size = <fidl::encoding::HandleType<
4037                    fidl::Event,
4038                    { fidl::ObjectType::EVENT.into_raw() },
4039                    2147483648,
4040                > as fidl::encoding::TypeMarker>::inline_size(
4041                    decoder.context
4042                );
4043                if inlined != (member_inline_size <= 4) {
4044                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4045                }
4046                let inner_offset;
4047                let mut inner_depth = depth.clone();
4048                if inlined {
4049                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4050                    inner_offset = next_offset;
4051                } else {
4052                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4053                    inner_depth.increment()?;
4054                }
4055                let val_ref =
4056                self.component_instance.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
4057                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4058                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4059                {
4060                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4061                }
4062                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4063                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4064                }
4065            }
4066
4067            next_offset += envelope_size;
4068            _next_ordinal_to_read += 1;
4069            if next_offset >= end_offset {
4070                return Ok(());
4071            }
4072
4073            // Decode unknown envelopes for gaps in ordinals.
4074            while _next_ordinal_to_read < 10 {
4075                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4076                _next_ordinal_to_read += 1;
4077                next_offset += envelope_size;
4078            }
4079
4080            let next_out_of_line = decoder.next_out_of_line();
4081            let handles_before = decoder.remaining_handles();
4082            if let Some((inlined, num_bytes, num_handles)) =
4083                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4084            {
4085                let member_inline_size = <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4086                if inlined != (member_inline_size <= 4) {
4087                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4088                }
4089                let inner_offset;
4090                let mut inner_depth = depth.clone();
4091                if inlined {
4092                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4093                    inner_offset = next_offset;
4094                } else {
4095                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4096                    inner_depth.increment()?;
4097                }
4098                let val_ref = self.escrowed_dictionary.get_or_insert_with(|| {
4099                    fidl::new_empty!(
4100                        fidl_fuchsia_component_sandbox::DictionaryRef,
4101                        fidl::encoding::DefaultFuchsiaResourceDialect
4102                    )
4103                });
4104                fidl::decode!(
4105                    fidl_fuchsia_component_sandbox::DictionaryRef,
4106                    fidl::encoding::DefaultFuchsiaResourceDialect,
4107                    val_ref,
4108                    decoder,
4109                    inner_offset,
4110                    inner_depth
4111                )?;
4112                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4113                {
4114                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4115                }
4116                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4117                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4118                }
4119            }
4120
4121            next_offset += envelope_size;
4122            _next_ordinal_to_read += 1;
4123            if next_offset >= end_offset {
4124                return Ok(());
4125            }
4126
4127            // Decode unknown envelopes for gaps in ordinals.
4128            while _next_ordinal_to_read < 11 {
4129                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4130                _next_ordinal_to_read += 1;
4131                next_offset += envelope_size;
4132            }
4133
4134            let next_out_of_line = decoder.next_out_of_line();
4135            let handles_before = decoder.remaining_handles();
4136            if let Some((inlined, num_bytes, num_handles)) =
4137                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4138            {
4139                let member_inline_size = <fidl::encoding::HandleType<
4140                    fidl::EventPair,
4141                    { fidl::ObjectType::EVENTPAIR.into_raw() },
4142                    2147483648,
4143                > as fidl::encoding::TypeMarker>::inline_size(
4144                    decoder.context
4145                );
4146                if inlined != (member_inline_size <= 4) {
4147                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4148                }
4149                let inner_offset;
4150                let mut inner_depth = depth.clone();
4151                if inlined {
4152                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4153                    inner_offset = next_offset;
4154                } else {
4155                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4156                    inner_depth.increment()?;
4157                }
4158                let val_ref =
4159                self.escrowed_dictionary_handle.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
4160                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4161                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4162                {
4163                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4164                }
4165                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4166                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4167                }
4168            }
4169
4170            next_offset += envelope_size;
4171
4172            // Decode the remaining unknown envelopes.
4173            while next_offset < end_offset {
4174                _next_ordinal_to_read += 1;
4175                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4176                next_offset += envelope_size;
4177            }
4178
4179            Ok(())
4180        }
4181    }
4182
4183    impl ComponentStopInfo {
4184        #[inline(always)]
4185        fn max_ordinal_present(&self) -> u64 {
4186            if let Some(_) = self.exit_code {
4187                return 2;
4188            }
4189            if let Some(_) = self.termination_status {
4190                return 1;
4191            }
4192            0
4193        }
4194    }
4195
4196    impl fidl::encoding::ResourceTypeMarker for ComponentStopInfo {
4197        type Borrowed<'a> = &'a mut Self;
4198        fn take_or_borrow<'a>(
4199            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4200        ) -> Self::Borrowed<'a> {
4201            value
4202        }
4203    }
4204
4205    unsafe impl fidl::encoding::TypeMarker for ComponentStopInfo {
4206        type Owned = Self;
4207
4208        #[inline(always)]
4209        fn inline_align(_context: fidl::encoding::Context) -> usize {
4210            8
4211        }
4212
4213        #[inline(always)]
4214        fn inline_size(_context: fidl::encoding::Context) -> usize {
4215            16
4216        }
4217    }
4218
4219    unsafe impl
4220        fidl::encoding::Encode<ComponentStopInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
4221        for &mut ComponentStopInfo
4222    {
4223        unsafe fn encode(
4224            self,
4225            encoder: &mut fidl::encoding::Encoder<
4226                '_,
4227                fidl::encoding::DefaultFuchsiaResourceDialect,
4228            >,
4229            offset: usize,
4230            mut depth: fidl::encoding::Depth,
4231        ) -> fidl::Result<()> {
4232            encoder.debug_check_bounds::<ComponentStopInfo>(offset);
4233            // Vector header
4234            let max_ordinal: u64 = self.max_ordinal_present();
4235            encoder.write_num(max_ordinal, offset);
4236            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4237            // Calling encoder.out_of_line_offset(0) is not allowed.
4238            if max_ordinal == 0 {
4239                return Ok(());
4240            }
4241            depth.increment()?;
4242            let envelope_size = 8;
4243            let bytes_len = max_ordinal as usize * envelope_size;
4244            #[allow(unused_variables)]
4245            let offset = encoder.out_of_line_offset(bytes_len);
4246            let mut _prev_end_offset: usize = 0;
4247            if 1 > max_ordinal {
4248                return Ok(());
4249            }
4250
4251            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4252            // are envelope_size bytes.
4253            let cur_offset: usize = (1 - 1) * envelope_size;
4254
4255            // Zero reserved fields.
4256            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4257
4258            // Safety:
4259            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4260            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4261            //   envelope_size bytes, there is always sufficient room.
4262            fidl::encoding::encode_in_envelope_optional::<
4263                i32,
4264                fidl::encoding::DefaultFuchsiaResourceDialect,
4265            >(
4266                self.termination_status
4267                    .as_ref()
4268                    .map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
4269                encoder,
4270                offset + cur_offset,
4271                depth,
4272            )?;
4273
4274            _prev_end_offset = cur_offset + envelope_size;
4275            if 2 > max_ordinal {
4276                return Ok(());
4277            }
4278
4279            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4280            // are envelope_size bytes.
4281            let cur_offset: usize = (2 - 1) * envelope_size;
4282
4283            // Zero reserved fields.
4284            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4285
4286            // Safety:
4287            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4288            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4289            //   envelope_size bytes, there is always sufficient room.
4290            fidl::encoding::encode_in_envelope_optional::<
4291                i64,
4292                fidl::encoding::DefaultFuchsiaResourceDialect,
4293            >(
4294                self.exit_code.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4295                encoder,
4296                offset + cur_offset,
4297                depth,
4298            )?;
4299
4300            _prev_end_offset = cur_offset + envelope_size;
4301
4302            Ok(())
4303        }
4304    }
4305
4306    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4307        for ComponentStopInfo
4308    {
4309        #[inline(always)]
4310        fn new_empty() -> Self {
4311            Self::default()
4312        }
4313
4314        unsafe fn decode(
4315            &mut self,
4316            decoder: &mut fidl::encoding::Decoder<
4317                '_,
4318                fidl::encoding::DefaultFuchsiaResourceDialect,
4319            >,
4320            offset: usize,
4321            mut depth: fidl::encoding::Depth,
4322        ) -> fidl::Result<()> {
4323            decoder.debug_check_bounds::<Self>(offset);
4324            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4325                None => return Err(fidl::Error::NotNullable),
4326                Some(len) => len,
4327            };
4328            // Calling decoder.out_of_line_offset(0) is not allowed.
4329            if len == 0 {
4330                return Ok(());
4331            };
4332            depth.increment()?;
4333            let envelope_size = 8;
4334            let bytes_len = len * envelope_size;
4335            let offset = decoder.out_of_line_offset(bytes_len)?;
4336            // Decode the envelope for each type.
4337            let mut _next_ordinal_to_read = 0;
4338            let mut next_offset = offset;
4339            let end_offset = offset + bytes_len;
4340            _next_ordinal_to_read += 1;
4341            if next_offset >= end_offset {
4342                return Ok(());
4343            }
4344
4345            // Decode unknown envelopes for gaps in ordinals.
4346            while _next_ordinal_to_read < 1 {
4347                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4348                _next_ordinal_to_read += 1;
4349                next_offset += envelope_size;
4350            }
4351
4352            let next_out_of_line = decoder.next_out_of_line();
4353            let handles_before = decoder.remaining_handles();
4354            if let Some((inlined, num_bytes, num_handles)) =
4355                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4356            {
4357                let member_inline_size =
4358                    <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4359                if inlined != (member_inline_size <= 4) {
4360                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4361                }
4362                let inner_offset;
4363                let mut inner_depth = depth.clone();
4364                if inlined {
4365                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4366                    inner_offset = next_offset;
4367                } else {
4368                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4369                    inner_depth.increment()?;
4370                }
4371                let val_ref = self.termination_status.get_or_insert_with(|| {
4372                    fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect)
4373                });
4374                fidl::decode!(
4375                    i32,
4376                    fidl::encoding::DefaultFuchsiaResourceDialect,
4377                    val_ref,
4378                    decoder,
4379                    inner_offset,
4380                    inner_depth
4381                )?;
4382                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4383                {
4384                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4385                }
4386                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4387                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4388                }
4389            }
4390
4391            next_offset += envelope_size;
4392            _next_ordinal_to_read += 1;
4393            if next_offset >= end_offset {
4394                return Ok(());
4395            }
4396
4397            // Decode unknown envelopes for gaps in ordinals.
4398            while _next_ordinal_to_read < 2 {
4399                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4400                _next_ordinal_to_read += 1;
4401                next_offset += envelope_size;
4402            }
4403
4404            let next_out_of_line = decoder.next_out_of_line();
4405            let handles_before = decoder.remaining_handles();
4406            if let Some((inlined, num_bytes, num_handles)) =
4407                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4408            {
4409                let member_inline_size =
4410                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4411                if inlined != (member_inline_size <= 4) {
4412                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4413                }
4414                let inner_offset;
4415                let mut inner_depth = depth.clone();
4416                if inlined {
4417                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4418                    inner_offset = next_offset;
4419                } else {
4420                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4421                    inner_depth.increment()?;
4422                }
4423                let val_ref = self.exit_code.get_or_insert_with(|| {
4424                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
4425                });
4426                fidl::decode!(
4427                    i64,
4428                    fidl::encoding::DefaultFuchsiaResourceDialect,
4429                    val_ref,
4430                    decoder,
4431                    inner_offset,
4432                    inner_depth
4433                )?;
4434                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4435                {
4436                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4437                }
4438                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4439                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4440                }
4441            }
4442
4443            next_offset += envelope_size;
4444
4445            // Decode the remaining unknown envelopes.
4446            while next_offset < end_offset {
4447                _next_ordinal_to_read += 1;
4448                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4449                next_offset += envelope_size;
4450            }
4451
4452            Ok(())
4453        }
4454    }
4455
4456    impl ComponentTasks {
4457        #[inline(always)]
4458        fn max_ordinal_present(&self) -> u64 {
4459            if let Some(_) = self.parent_task {
4460                return 2;
4461            }
4462            if let Some(_) = self.component_task {
4463                return 1;
4464            }
4465            0
4466        }
4467    }
4468
4469    impl fidl::encoding::ResourceTypeMarker for ComponentTasks {
4470        type Borrowed<'a> = &'a mut Self;
4471        fn take_or_borrow<'a>(
4472            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4473        ) -> Self::Borrowed<'a> {
4474            value
4475        }
4476    }
4477
4478    unsafe impl fidl::encoding::TypeMarker for ComponentTasks {
4479        type Owned = Self;
4480
4481        #[inline(always)]
4482        fn inline_align(_context: fidl::encoding::Context) -> usize {
4483            8
4484        }
4485
4486        #[inline(always)]
4487        fn inline_size(_context: fidl::encoding::Context) -> usize {
4488            16
4489        }
4490    }
4491
4492    unsafe impl
4493        fidl::encoding::Encode<ComponentTasks, fidl::encoding::DefaultFuchsiaResourceDialect>
4494        for &mut ComponentTasks
4495    {
4496        unsafe fn encode(
4497            self,
4498            encoder: &mut fidl::encoding::Encoder<
4499                '_,
4500                fidl::encoding::DefaultFuchsiaResourceDialect,
4501            >,
4502            offset: usize,
4503            mut depth: fidl::encoding::Depth,
4504        ) -> fidl::Result<()> {
4505            encoder.debug_check_bounds::<ComponentTasks>(offset);
4506            // Vector header
4507            let max_ordinal: u64 = self.max_ordinal_present();
4508            encoder.write_num(max_ordinal, offset);
4509            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4510            // Calling encoder.out_of_line_offset(0) is not allowed.
4511            if max_ordinal == 0 {
4512                return Ok(());
4513            }
4514            depth.increment()?;
4515            let envelope_size = 8;
4516            let bytes_len = max_ordinal as usize * envelope_size;
4517            #[allow(unused_variables)]
4518            let offset = encoder.out_of_line_offset(bytes_len);
4519            let mut _prev_end_offset: usize = 0;
4520            if 1 > max_ordinal {
4521                return Ok(());
4522            }
4523
4524            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4525            // are envelope_size bytes.
4526            let cur_offset: usize = (1 - 1) * envelope_size;
4527
4528            // Zero reserved fields.
4529            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4530
4531            // Safety:
4532            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4533            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4534            //   envelope_size bytes, there is always sufficient room.
4535            fidl::encoding::encode_in_envelope_optional::<
4536                Task,
4537                fidl::encoding::DefaultFuchsiaResourceDialect,
4538            >(
4539                self.component_task
4540                    .as_mut()
4541                    .map(<Task as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
4542                encoder,
4543                offset + cur_offset,
4544                depth,
4545            )?;
4546
4547            _prev_end_offset = cur_offset + envelope_size;
4548            if 2 > max_ordinal {
4549                return Ok(());
4550            }
4551
4552            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4553            // are envelope_size bytes.
4554            let cur_offset: usize = (2 - 1) * envelope_size;
4555
4556            // Zero reserved fields.
4557            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4558
4559            // Safety:
4560            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4561            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4562            //   envelope_size bytes, there is always sufficient room.
4563            fidl::encoding::encode_in_envelope_optional::<
4564                Task,
4565                fidl::encoding::DefaultFuchsiaResourceDialect,
4566            >(
4567                self.parent_task
4568                    .as_mut()
4569                    .map(<Task as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
4570                encoder,
4571                offset + cur_offset,
4572                depth,
4573            )?;
4574
4575            _prev_end_offset = cur_offset + envelope_size;
4576
4577            Ok(())
4578        }
4579    }
4580
4581    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4582        for ComponentTasks
4583    {
4584        #[inline(always)]
4585        fn new_empty() -> Self {
4586            Self::default()
4587        }
4588
4589        unsafe fn decode(
4590            &mut self,
4591            decoder: &mut fidl::encoding::Decoder<
4592                '_,
4593                fidl::encoding::DefaultFuchsiaResourceDialect,
4594            >,
4595            offset: usize,
4596            mut depth: fidl::encoding::Depth,
4597        ) -> fidl::Result<()> {
4598            decoder.debug_check_bounds::<Self>(offset);
4599            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4600                None => return Err(fidl::Error::NotNullable),
4601                Some(len) => len,
4602            };
4603            // Calling decoder.out_of_line_offset(0) is not allowed.
4604            if len == 0 {
4605                return Ok(());
4606            };
4607            depth.increment()?;
4608            let envelope_size = 8;
4609            let bytes_len = len * envelope_size;
4610            let offset = decoder.out_of_line_offset(bytes_len)?;
4611            // Decode the envelope for each type.
4612            let mut _next_ordinal_to_read = 0;
4613            let mut next_offset = offset;
4614            let end_offset = offset + bytes_len;
4615            _next_ordinal_to_read += 1;
4616            if next_offset >= end_offset {
4617                return Ok(());
4618            }
4619
4620            // Decode unknown envelopes for gaps in ordinals.
4621            while _next_ordinal_to_read < 1 {
4622                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4623                _next_ordinal_to_read += 1;
4624                next_offset += envelope_size;
4625            }
4626
4627            let next_out_of_line = decoder.next_out_of_line();
4628            let handles_before = decoder.remaining_handles();
4629            if let Some((inlined, num_bytes, num_handles)) =
4630                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4631            {
4632                let member_inline_size =
4633                    <Task as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4634                if inlined != (member_inline_size <= 4) {
4635                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4636                }
4637                let inner_offset;
4638                let mut inner_depth = depth.clone();
4639                if inlined {
4640                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4641                    inner_offset = next_offset;
4642                } else {
4643                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4644                    inner_depth.increment()?;
4645                }
4646                let val_ref = self.component_task.get_or_insert_with(|| {
4647                    fidl::new_empty!(Task, fidl::encoding::DefaultFuchsiaResourceDialect)
4648                });
4649                fidl::decode!(
4650                    Task,
4651                    fidl::encoding::DefaultFuchsiaResourceDialect,
4652                    val_ref,
4653                    decoder,
4654                    inner_offset,
4655                    inner_depth
4656                )?;
4657                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4658                {
4659                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4660                }
4661                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4662                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4663                }
4664            }
4665
4666            next_offset += envelope_size;
4667            _next_ordinal_to_read += 1;
4668            if next_offset >= end_offset {
4669                return Ok(());
4670            }
4671
4672            // Decode unknown envelopes for gaps in ordinals.
4673            while _next_ordinal_to_read < 2 {
4674                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4675                _next_ordinal_to_read += 1;
4676                next_offset += envelope_size;
4677            }
4678
4679            let next_out_of_line = decoder.next_out_of_line();
4680            let handles_before = decoder.remaining_handles();
4681            if let Some((inlined, num_bytes, num_handles)) =
4682                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4683            {
4684                let member_inline_size =
4685                    <Task as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4686                if inlined != (member_inline_size <= 4) {
4687                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4688                }
4689                let inner_offset;
4690                let mut inner_depth = depth.clone();
4691                if inlined {
4692                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4693                    inner_offset = next_offset;
4694                } else {
4695                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4696                    inner_depth.increment()?;
4697                }
4698                let val_ref = self.parent_task.get_or_insert_with(|| {
4699                    fidl::new_empty!(Task, fidl::encoding::DefaultFuchsiaResourceDialect)
4700                });
4701                fidl::decode!(
4702                    Task,
4703                    fidl::encoding::DefaultFuchsiaResourceDialect,
4704                    val_ref,
4705                    decoder,
4706                    inner_offset,
4707                    inner_depth
4708                )?;
4709                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4710                {
4711                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4712                }
4713                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4714                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4715                }
4716            }
4717
4718            next_offset += envelope_size;
4719
4720            // Decode the remaining unknown envelopes.
4721            while next_offset < end_offset {
4722                _next_ordinal_to_read += 1;
4723                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4724                next_offset += envelope_size;
4725            }
4726
4727            Ok(())
4728        }
4729    }
4730
4731    impl fidl::encoding::ResourceTypeMarker for Task {
4732        type Borrowed<'a> = &'a mut Self;
4733        fn take_or_borrow<'a>(
4734            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4735        ) -> Self::Borrowed<'a> {
4736            value
4737        }
4738    }
4739
4740    unsafe impl fidl::encoding::TypeMarker for Task {
4741        type Owned = Self;
4742
4743        #[inline(always)]
4744        fn inline_align(_context: fidl::encoding::Context) -> usize {
4745            8
4746        }
4747
4748        #[inline(always)]
4749        fn inline_size(_context: fidl::encoding::Context) -> usize {
4750            16
4751        }
4752    }
4753
4754    unsafe impl fidl::encoding::Encode<Task, fidl::encoding::DefaultFuchsiaResourceDialect>
4755        for &mut Task
4756    {
4757        #[inline]
4758        unsafe fn encode(
4759            self,
4760            encoder: &mut fidl::encoding::Encoder<
4761                '_,
4762                fidl::encoding::DefaultFuchsiaResourceDialect,
4763            >,
4764            offset: usize,
4765            _depth: fidl::encoding::Depth,
4766        ) -> fidl::Result<()> {
4767            encoder.debug_check_bounds::<Task>(offset);
4768            encoder.write_num::<u64>(self.ordinal(), offset);
4769            match self {
4770                Task::Job(ref mut val) => fidl::encoding::encode_in_envelope::<
4771                    fidl::encoding::HandleType<
4772                        fidl::Job,
4773                        { fidl::ObjectType::JOB.into_raw() },
4774                        2147483648,
4775                    >,
4776                    fidl::encoding::DefaultFuchsiaResourceDialect,
4777                >(
4778                    <fidl::encoding::HandleType<
4779                        fidl::Job,
4780                        { fidl::ObjectType::JOB.into_raw() },
4781                        2147483648,
4782                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4783                        val
4784                    ),
4785                    encoder,
4786                    offset + 8,
4787                    _depth,
4788                ),
4789                Task::Process(ref mut val) => fidl::encoding::encode_in_envelope::<
4790                    fidl::encoding::HandleType<
4791                        fidl::Process,
4792                        { fidl::ObjectType::PROCESS.into_raw() },
4793                        2147483648,
4794                    >,
4795                    fidl::encoding::DefaultFuchsiaResourceDialect,
4796                >(
4797                    <fidl::encoding::HandleType<
4798                        fidl::Process,
4799                        { fidl::ObjectType::PROCESS.into_raw() },
4800                        2147483648,
4801                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4802                        val
4803                    ),
4804                    encoder,
4805                    offset + 8,
4806                    _depth,
4807                ),
4808                Task::Thread(ref mut val) => fidl::encoding::encode_in_envelope::<
4809                    fidl::encoding::HandleType<
4810                        fidl::Thread,
4811                        { fidl::ObjectType::THREAD.into_raw() },
4812                        2147483648,
4813                    >,
4814                    fidl::encoding::DefaultFuchsiaResourceDialect,
4815                >(
4816                    <fidl::encoding::HandleType<
4817                        fidl::Thread,
4818                        { fidl::ObjectType::THREAD.into_raw() },
4819                        2147483648,
4820                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4821                        val
4822                    ),
4823                    encoder,
4824                    offset + 8,
4825                    _depth,
4826                ),
4827                Task::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
4828            }
4829        }
4830    }
4831
4832    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Task {
4833        #[inline(always)]
4834        fn new_empty() -> Self {
4835            Self::__SourceBreaking { unknown_ordinal: 0 }
4836        }
4837
4838        #[inline]
4839        unsafe fn decode(
4840            &mut self,
4841            decoder: &mut fidl::encoding::Decoder<
4842                '_,
4843                fidl::encoding::DefaultFuchsiaResourceDialect,
4844            >,
4845            offset: usize,
4846            mut depth: fidl::encoding::Depth,
4847        ) -> fidl::Result<()> {
4848            decoder.debug_check_bounds::<Self>(offset);
4849            #[allow(unused_variables)]
4850            let next_out_of_line = decoder.next_out_of_line();
4851            let handles_before = decoder.remaining_handles();
4852            let (ordinal, inlined, num_bytes, num_handles) =
4853                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4854
4855            let member_inline_size = match ordinal {
4856                1 => <fidl::encoding::HandleType<
4857                    fidl::Job,
4858                    { fidl::ObjectType::JOB.into_raw() },
4859                    2147483648,
4860                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4861                2 => <fidl::encoding::HandleType<
4862                    fidl::Process,
4863                    { fidl::ObjectType::PROCESS.into_raw() },
4864                    2147483648,
4865                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4866                3 => <fidl::encoding::HandleType<
4867                    fidl::Thread,
4868                    { fidl::ObjectType::THREAD.into_raw() },
4869                    2147483648,
4870                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4871                0 => return Err(fidl::Error::UnknownUnionTag),
4872                _ => num_bytes as usize,
4873            };
4874
4875            if inlined != (member_inline_size <= 4) {
4876                return Err(fidl::Error::InvalidInlineBitInEnvelope);
4877            }
4878            let _inner_offset;
4879            if inlined {
4880                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4881                _inner_offset = offset + 8;
4882            } else {
4883                depth.increment()?;
4884                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4885            }
4886            match ordinal {
4887                1 => {
4888                    #[allow(irrefutable_let_patterns)]
4889                    if let Task::Job(_) = self {
4890                        // Do nothing, read the value into the object
4891                    } else {
4892                        // Initialize `self` to the right variant
4893                        *self = Task::Job(
4894                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4895                        );
4896                    }
4897                    #[allow(irrefutable_let_patterns)]
4898                    if let Task::Job(ref mut val) = self {
4899                        fidl::decode!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
4900                    } else {
4901                        unreachable!()
4902                    }
4903                }
4904                2 => {
4905                    #[allow(irrefutable_let_patterns)]
4906                    if let Task::Process(_) = self {
4907                        // Do nothing, read the value into the object
4908                    } else {
4909                        // Initialize `self` to the right variant
4910                        *self = Task::Process(
4911                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4912                        );
4913                    }
4914                    #[allow(irrefutable_let_patterns)]
4915                    if let Task::Process(ref mut val) = self {
4916                        fidl::decode!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
4917                    } else {
4918                        unreachable!()
4919                    }
4920                }
4921                3 => {
4922                    #[allow(irrefutable_let_patterns)]
4923                    if let Task::Thread(_) = self {
4924                        // Do nothing, read the value into the object
4925                    } else {
4926                        // Initialize `self` to the right variant
4927                        *self = Task::Thread(
4928                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4929                        );
4930                    }
4931                    #[allow(irrefutable_let_patterns)]
4932                    if let Task::Thread(ref mut val) = self {
4933                        fidl::decode!(fidl::encoding::HandleType<fidl::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
4934                    } else {
4935                        unreachable!()
4936                    }
4937                }
4938                #[allow(deprecated)]
4939                ordinal => {
4940                    for _ in 0..num_handles {
4941                        decoder.drop_next_handle()?;
4942                    }
4943                    *self = Task::__SourceBreaking { unknown_ordinal: ordinal };
4944                }
4945            }
4946            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
4947                return Err(fidl::Error::InvalidNumBytesInEnvelope);
4948            }
4949            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4950                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4951            }
4952            Ok(())
4953        }
4954    }
4955}