Skip to main content

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