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