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