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