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