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