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