fidl_fuchsia_process/
fidl_fuchsia_process.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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13/// The maximum size for a name used by `Resolver`.
14pub const MAX_RESOLVE_NAME_SIZE: u32 = 2048;
15
16/// Information about a handle provided to a process at startup.
17///
18/// Processes are given a set of initial handles as part of the bootstrapping
19/// sequence. Some of these handles are associated with process argument
20/// identifiers that designate their intended use by the new process.
21///
22/// This structure represents one such handle and its associated identifier.
23#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
24pub struct HandleInfo {
25    /// The handle to use for this process argument.
26    pub handle: fidl::Handle,
27    /// Process argument identifier.
28    ///
29    /// See <zircon/processargs.h> for definitions of well-known process
30    /// arguments.
31    pub id: u32,
32}
33
34impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for HandleInfo {}
35
36/// The information needed to launch a process.
37#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
38pub struct LaunchInfo {
39    /// The executable to run in the process.
40    pub executable: fidl::Vmo,
41    /// The job in which to create the process.
42    pub job: fidl::Job,
43    /// The name to assign to the created process.
44    pub name: String,
45}
46
47impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LaunchInfo {}
48
49#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
50pub struct LauncherAddArgsRequest {
51    pub args: Vec<Vec<u8>>,
52}
53
54impl fidl::Persistable for LauncherAddArgsRequest {}
55
56#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
57pub struct LauncherAddEnvironsRequest {
58    pub environ: Vec<Vec<u8>>,
59}
60
61impl fidl::Persistable for LauncherAddEnvironsRequest {}
62
63#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
64pub struct LauncherAddHandlesRequest {
65    pub handles: Vec<HandleInfo>,
66}
67
68impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LauncherAddHandlesRequest {}
69
70#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
71pub struct LauncherAddNamesRequest {
72    pub names: Vec<NameInfo>,
73}
74
75impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LauncherAddNamesRequest {}
76
77#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
78pub struct LauncherCreateWithoutStartingRequest {
79    pub info: LaunchInfo,
80}
81
82impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
83    for LauncherCreateWithoutStartingRequest
84{
85}
86
87#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
88pub struct LauncherCreateWithoutStartingResponse {
89    pub status: i32,
90    pub data: Option<Box<ProcessStartData>>,
91}
92
93impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
94    for LauncherCreateWithoutStartingResponse
95{
96}
97
98#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
99pub struct LauncherLaunchRequest {
100    pub info: LaunchInfo,
101}
102
103impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LauncherLaunchRequest {}
104
105#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
106pub struct LauncherLaunchResponse {
107    pub status: i32,
108    pub process: Option<fidl::Process>,
109}
110
111impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LauncherLaunchResponse {}
112
113#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
114#[repr(C)]
115pub struct LauncherSetOptionsRequest {
116    /// These options are expected to be valid process creation options. The options are checked
117    /// on `Launch` or `CreateWithoutStarting`.
118    ///
119    /// See <https://fuchsia.dev/fuchsia-src/reference/syscalls/process_create> for details.
120    pub options: u32,
121}
122
123impl fidl::Persistable for LauncherSetOptionsRequest {}
124
125/// A namespace entry provided to a process at startup.
126///
127/// Processes are given a set of initial handles as part of the bootstrapping
128/// sequence. Some of these handles are associated with paths that designate
129/// their intended use by the new process as namespace entries.
130///
131/// This structure represents one such handle and its associated namespace path.
132#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
133pub struct NameInfo {
134    /// Path at which to install the associated directory.
135    ///
136    /// Must be an absolute path (i.e., start with '/').
137    pub path: String,
138    /// The associated directory.
139    pub directory: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
140}
141
142impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NameInfo {}
143
144/// The information required to start a process.
145///
146/// To start the process, call `zx_process_start` with the arguments provided.
147#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
148pub struct ProcessStartData {
149    /// The process that was created.
150    pub process: fidl::Process,
151    /// The vmar object that was created when the process was created.
152    ///
153    /// See <https://fuchsia.dev/fuchsia-src/reference/syscalls/process_create.md>.
154    pub root_vmar: fidl::Vmar,
155    /// The initial thread for the process.
156    ///
157    /// Should be passed to `zx_process_start` when starting the process.
158    pub thread: fidl::Thread,
159    /// The address of the initial entry point in the process.
160    ///
161    /// Should be passed to `zx_process_start` when starting the process.
162    pub entry: u64,
163    /// The stack pointer value for the initial thread of the process.
164    ///
165    /// Should be passed to `zx_process_start` when starting the process.
166    pub stack: u64,
167    /// The bootstrap channel to pass to the process on startup.
168    ///
169    /// Should be passed to `zx_process_start` when starting the process.
170    pub bootstrap: fidl::Channel,
171    /// The base address of the vDSO to pass to the process on startup.
172    ///
173    /// Should be passed to `zx_process_start` when starting the process.
174    pub vdso_base: u64,
175    /// The base load address of the ELF file loaded.
176    ///
177    /// Most often used by debuggers or other tools that inspect the process.
178    pub base: u64,
179}
180
181impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProcessStartData {}
182
183#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
184pub struct ResolverResolveRequest {
185    pub name: String,
186}
187
188impl fidl::Persistable for ResolverResolveRequest {}
189
190#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
191pub struct ResolverResolveResponse {
192    pub status: i32,
193    pub executable: Option<fidl::Vmo>,
194    pub ldsvc: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
195}
196
197impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ResolverResolveResponse {}
198
199#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
200pub struct LauncherMarker;
201
202impl fidl::endpoints::ProtocolMarker for LauncherMarker {
203    type Proxy = LauncherProxy;
204    type RequestStream = LauncherRequestStream;
205    #[cfg(target_os = "fuchsia")]
206    type SynchronousProxy = LauncherSynchronousProxy;
207
208    const DEBUG_NAME: &'static str = "fuchsia.process.Launcher";
209}
210impl fidl::endpoints::DiscoverableProtocolMarker for LauncherMarker {}
211
212pub trait LauncherProxyInterface: Send + Sync {
213    type LaunchResponseFut: std::future::Future<Output = Result<(i32, Option<fidl::Process>), fidl::Error>>
214        + Send;
215    fn r#launch(&self, info: LaunchInfo) -> Self::LaunchResponseFut;
216    type CreateWithoutStartingResponseFut: std::future::Future<Output = Result<(i32, Option<Box<ProcessStartData>>), fidl::Error>>
217        + Send;
218    fn r#create_without_starting(&self, info: LaunchInfo)
219        -> Self::CreateWithoutStartingResponseFut;
220    fn r#add_args(&self, args: &[Vec<u8>]) -> Result<(), fidl::Error>;
221    fn r#add_environs(&self, environ: &[Vec<u8>]) -> Result<(), fidl::Error>;
222    fn r#add_names(&self, names: Vec<NameInfo>) -> Result<(), fidl::Error>;
223    fn r#add_handles(&self, handles: Vec<HandleInfo>) -> Result<(), fidl::Error>;
224    fn r#set_options(&self, options: u32) -> Result<(), fidl::Error>;
225}
226#[derive(Debug)]
227#[cfg(target_os = "fuchsia")]
228pub struct LauncherSynchronousProxy {
229    client: fidl::client::sync::Client,
230}
231
232#[cfg(target_os = "fuchsia")]
233impl fidl::endpoints::SynchronousProxy for LauncherSynchronousProxy {
234    type Proxy = LauncherProxy;
235    type Protocol = LauncherMarker;
236
237    fn from_channel(inner: fidl::Channel) -> Self {
238        Self::new(inner)
239    }
240
241    fn into_channel(self) -> fidl::Channel {
242        self.client.into_channel()
243    }
244
245    fn as_channel(&self) -> &fidl::Channel {
246        self.client.as_channel()
247    }
248}
249
250#[cfg(target_os = "fuchsia")]
251impl LauncherSynchronousProxy {
252    pub fn new(channel: fidl::Channel) -> Self {
253        let protocol_name = <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
254        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
255    }
256
257    pub fn into_channel(self) -> fidl::Channel {
258        self.client.into_channel()
259    }
260
261    /// Waits until an event arrives and returns it. It is safe for other
262    /// threads to make concurrent requests while waiting for an event.
263    pub fn wait_for_event(
264        &self,
265        deadline: zx::MonotonicInstant,
266    ) -> Result<LauncherEvent, fidl::Error> {
267        LauncherEvent::decode(self.client.wait_for_event(deadline)?)
268    }
269
270    /// Creates and starts the process described by `info`.
271    ///
272    /// After processing this message, the `Launcher` is reset to its initial
273    /// state and is ready to launch another process.
274    ///
275    /// `process` is present if, and only if, `status` is `ZX_OK`.
276    pub fn r#launch(
277        &self,
278        mut info: LaunchInfo,
279        ___deadline: zx::MonotonicInstant,
280    ) -> Result<(i32, Option<fidl::Process>), fidl::Error> {
281        let _response = self.client.send_query::<LauncherLaunchRequest, LauncherLaunchResponse>(
282            (&mut info,),
283            0x11335a9928afbfa4,
284            fidl::encoding::DynamicFlags::empty(),
285            ___deadline,
286        )?;
287        Ok((_response.status, _response.process))
288    }
289
290    /// Creates the process described by `info` but does not start it.
291    ///
292    /// After processing this message, the `Launcher` is reset to its initial
293    /// state and is ready to launch another process.
294    ///
295    /// The caller is responsible for calling `zx_process_start` using the data
296    /// in `ProcessStartData` to actually start the process.
297    ///
298    /// `data` is present if, and only if, `status` is `ZX_OK`.
299    pub fn r#create_without_starting(
300        &self,
301        mut info: LaunchInfo,
302        ___deadline: zx::MonotonicInstant,
303    ) -> Result<(i32, Option<Box<ProcessStartData>>), fidl::Error> {
304        let _response = self.client.send_query::<
305            LauncherCreateWithoutStartingRequest,
306            LauncherCreateWithoutStartingResponse,
307        >(
308            (&mut info,),
309            0x755f8263fe51cb61,
310            fidl::encoding::DynamicFlags::empty(),
311            ___deadline,
312        )?;
313        Ok((_response.status, _response.data))
314    }
315
316    /// Adds the given arguments to the command-line for the process.
317    ///
318    /// Calling this method multiple times concatenates the arguments.
319    pub fn r#add_args(&self, mut args: &[Vec<u8>]) -> Result<(), fidl::Error> {
320        self.client.send::<LauncherAddArgsRequest>(
321            (args,),
322            0x3be445d3e4fd6512,
323            fidl::encoding::DynamicFlags::empty(),
324        )
325    }
326
327    /// Adds the given variables to the environment variables for the process.
328    ///
329    /// Calling this method multiple times concatenates the variables.
330    pub fn r#add_environs(&self, mut environ: &[Vec<u8>]) -> Result<(), fidl::Error> {
331        self.client.send::<LauncherAddEnvironsRequest>(
332            (environ,),
333            0x73a3c97fa7fe1779,
334            fidl::encoding::DynamicFlags::empty(),
335        )
336    }
337
338    /// Adds the given names to the namespace for the process.
339    ///
340    /// The paths in the namespace must be non-overlapping. See
341    /// <https://fuchsia.dev/fuchsia-src/concepts/process/namespaces> for details.
342    ///
343    /// Calling this method multiple times concatenates the names.
344    pub fn r#add_names(&self, mut names: Vec<NameInfo>) -> Result<(), fidl::Error> {
345        self.client.send::<LauncherAddNamesRequest>(
346            (names.as_mut(),),
347            0x2579ee2c7be28662,
348            fidl::encoding::DynamicFlags::empty(),
349        )
350    }
351
352    /// Adds the given handles to the startup handles for the process.
353    ///
354    /// Calling this method multiple times concatenates the handles.
355    pub fn r#add_handles(&self, mut handles: Vec<HandleInfo>) -> Result<(), fidl::Error> {
356        self.client.send::<LauncherAddHandlesRequest>(
357            (handles.as_mut(),),
358            0x51025267a537a615,
359            fidl::encoding::DynamicFlags::empty(),
360        )
361    }
362
363    /// Sets the options with which the process is created.
364    ///
365    /// Calling this method multiple times will overwrite the current options.
366    pub fn r#set_options(&self, mut options: u32) -> Result<(), fidl::Error> {
367        self.client.send::<LauncherSetOptionsRequest>(
368            (options,),
369            0x5b92576147ebfd87,
370            fidl::encoding::DynamicFlags::empty(),
371        )
372    }
373}
374
375#[derive(Debug, Clone)]
376pub struct LauncherProxy {
377    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
378}
379
380impl fidl::endpoints::Proxy for LauncherProxy {
381    type Protocol = LauncherMarker;
382
383    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
384        Self::new(inner)
385    }
386
387    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
388        self.client.into_channel().map_err(|client| Self { client })
389    }
390
391    fn as_channel(&self) -> &::fidl::AsyncChannel {
392        self.client.as_channel()
393    }
394}
395
396impl LauncherProxy {
397    /// Create a new Proxy for fuchsia.process/Launcher.
398    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
399        let protocol_name = <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
400        Self { client: fidl::client::Client::new(channel, protocol_name) }
401    }
402
403    /// Get a Stream of events from the remote end of the protocol.
404    ///
405    /// # Panics
406    ///
407    /// Panics if the event stream was already taken.
408    pub fn take_event_stream(&self) -> LauncherEventStream {
409        LauncherEventStream { event_receiver: self.client.take_event_receiver() }
410    }
411
412    /// Creates and starts the process described by `info`.
413    ///
414    /// After processing this message, the `Launcher` is reset to its initial
415    /// state and is ready to launch another process.
416    ///
417    /// `process` is present if, and only if, `status` is `ZX_OK`.
418    pub fn r#launch(
419        &self,
420        mut info: LaunchInfo,
421    ) -> fidl::client::QueryResponseFut<
422        (i32, Option<fidl::Process>),
423        fidl::encoding::DefaultFuchsiaResourceDialect,
424    > {
425        LauncherProxyInterface::r#launch(self, info)
426    }
427
428    /// Creates the process described by `info` but does not start it.
429    ///
430    /// After processing this message, the `Launcher` is reset to its initial
431    /// state and is ready to launch another process.
432    ///
433    /// The caller is responsible for calling `zx_process_start` using the data
434    /// in `ProcessStartData` to actually start the process.
435    ///
436    /// `data` is present if, and only if, `status` is `ZX_OK`.
437    pub fn r#create_without_starting(
438        &self,
439        mut info: LaunchInfo,
440    ) -> fidl::client::QueryResponseFut<
441        (i32, Option<Box<ProcessStartData>>),
442        fidl::encoding::DefaultFuchsiaResourceDialect,
443    > {
444        LauncherProxyInterface::r#create_without_starting(self, info)
445    }
446
447    /// Adds the given arguments to the command-line for the process.
448    ///
449    /// Calling this method multiple times concatenates the arguments.
450    pub fn r#add_args(&self, mut args: &[Vec<u8>]) -> Result<(), fidl::Error> {
451        LauncherProxyInterface::r#add_args(self, args)
452    }
453
454    /// Adds the given variables to the environment variables for the process.
455    ///
456    /// Calling this method multiple times concatenates the variables.
457    pub fn r#add_environs(&self, mut environ: &[Vec<u8>]) -> Result<(), fidl::Error> {
458        LauncherProxyInterface::r#add_environs(self, environ)
459    }
460
461    /// Adds the given names to the namespace for the process.
462    ///
463    /// The paths in the namespace must be non-overlapping. See
464    /// <https://fuchsia.dev/fuchsia-src/concepts/process/namespaces> for details.
465    ///
466    /// Calling this method multiple times concatenates the names.
467    pub fn r#add_names(&self, mut names: Vec<NameInfo>) -> Result<(), fidl::Error> {
468        LauncherProxyInterface::r#add_names(self, names)
469    }
470
471    /// Adds the given handles to the startup handles for the process.
472    ///
473    /// Calling this method multiple times concatenates the handles.
474    pub fn r#add_handles(&self, mut handles: Vec<HandleInfo>) -> Result<(), fidl::Error> {
475        LauncherProxyInterface::r#add_handles(self, handles)
476    }
477
478    /// Sets the options with which the process is created.
479    ///
480    /// Calling this method multiple times will overwrite the current options.
481    pub fn r#set_options(&self, mut options: u32) -> Result<(), fidl::Error> {
482        LauncherProxyInterface::r#set_options(self, options)
483    }
484}
485
486impl LauncherProxyInterface for LauncherProxy {
487    type LaunchResponseFut = fidl::client::QueryResponseFut<
488        (i32, Option<fidl::Process>),
489        fidl::encoding::DefaultFuchsiaResourceDialect,
490    >;
491    fn r#launch(&self, mut info: LaunchInfo) -> Self::LaunchResponseFut {
492        fn _decode(
493            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
494        ) -> Result<(i32, Option<fidl::Process>), fidl::Error> {
495            let _response = fidl::client::decode_transaction_body::<
496                LauncherLaunchResponse,
497                fidl::encoding::DefaultFuchsiaResourceDialect,
498                0x11335a9928afbfa4,
499            >(_buf?)?;
500            Ok((_response.status, _response.process))
501        }
502        self.client.send_query_and_decode::<LauncherLaunchRequest, (i32, Option<fidl::Process>)>(
503            (&mut info,),
504            0x11335a9928afbfa4,
505            fidl::encoding::DynamicFlags::empty(),
506            _decode,
507        )
508    }
509
510    type CreateWithoutStartingResponseFut = fidl::client::QueryResponseFut<
511        (i32, Option<Box<ProcessStartData>>),
512        fidl::encoding::DefaultFuchsiaResourceDialect,
513    >;
514    fn r#create_without_starting(
515        &self,
516        mut info: LaunchInfo,
517    ) -> Self::CreateWithoutStartingResponseFut {
518        fn _decode(
519            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
520        ) -> Result<(i32, Option<Box<ProcessStartData>>), fidl::Error> {
521            let _response = fidl::client::decode_transaction_body::<
522                LauncherCreateWithoutStartingResponse,
523                fidl::encoding::DefaultFuchsiaResourceDialect,
524                0x755f8263fe51cb61,
525            >(_buf?)?;
526            Ok((_response.status, _response.data))
527        }
528        self.client.send_query_and_decode::<
529            LauncherCreateWithoutStartingRequest,
530            (i32, Option<Box<ProcessStartData>>),
531        >(
532            (&mut info,),
533            0x755f8263fe51cb61,
534            fidl::encoding::DynamicFlags::empty(),
535            _decode,
536        )
537    }
538
539    fn r#add_args(&self, mut args: &[Vec<u8>]) -> Result<(), fidl::Error> {
540        self.client.send::<LauncherAddArgsRequest>(
541            (args,),
542            0x3be445d3e4fd6512,
543            fidl::encoding::DynamicFlags::empty(),
544        )
545    }
546
547    fn r#add_environs(&self, mut environ: &[Vec<u8>]) -> Result<(), fidl::Error> {
548        self.client.send::<LauncherAddEnvironsRequest>(
549            (environ,),
550            0x73a3c97fa7fe1779,
551            fidl::encoding::DynamicFlags::empty(),
552        )
553    }
554
555    fn r#add_names(&self, mut names: Vec<NameInfo>) -> Result<(), fidl::Error> {
556        self.client.send::<LauncherAddNamesRequest>(
557            (names.as_mut(),),
558            0x2579ee2c7be28662,
559            fidl::encoding::DynamicFlags::empty(),
560        )
561    }
562
563    fn r#add_handles(&self, mut handles: Vec<HandleInfo>) -> Result<(), fidl::Error> {
564        self.client.send::<LauncherAddHandlesRequest>(
565            (handles.as_mut(),),
566            0x51025267a537a615,
567            fidl::encoding::DynamicFlags::empty(),
568        )
569    }
570
571    fn r#set_options(&self, mut options: u32) -> Result<(), fidl::Error> {
572        self.client.send::<LauncherSetOptionsRequest>(
573            (options,),
574            0x5b92576147ebfd87,
575            fidl::encoding::DynamicFlags::empty(),
576        )
577    }
578}
579
580pub struct LauncherEventStream {
581    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
582}
583
584impl std::marker::Unpin for LauncherEventStream {}
585
586impl futures::stream::FusedStream for LauncherEventStream {
587    fn is_terminated(&self) -> bool {
588        self.event_receiver.is_terminated()
589    }
590}
591
592impl futures::Stream for LauncherEventStream {
593    type Item = Result<LauncherEvent, fidl::Error>;
594
595    fn poll_next(
596        mut self: std::pin::Pin<&mut Self>,
597        cx: &mut std::task::Context<'_>,
598    ) -> std::task::Poll<Option<Self::Item>> {
599        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
600            &mut self.event_receiver,
601            cx
602        )?) {
603            Some(buf) => std::task::Poll::Ready(Some(LauncherEvent::decode(buf))),
604            None => std::task::Poll::Ready(None),
605        }
606    }
607}
608
609#[derive(Debug)]
610pub enum LauncherEvent {}
611
612impl LauncherEvent {
613    /// Decodes a message buffer as a [`LauncherEvent`].
614    fn decode(
615        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
616    ) -> Result<LauncherEvent, fidl::Error> {
617        let (bytes, _handles) = buf.split_mut();
618        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
619        debug_assert_eq!(tx_header.tx_id, 0);
620        match tx_header.ordinal {
621            _ => Err(fidl::Error::UnknownOrdinal {
622                ordinal: tx_header.ordinal,
623                protocol_name: <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
624            }),
625        }
626    }
627}
628
629/// A Stream of incoming requests for fuchsia.process/Launcher.
630pub struct LauncherRequestStream {
631    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
632    is_terminated: bool,
633}
634
635impl std::marker::Unpin for LauncherRequestStream {}
636
637impl futures::stream::FusedStream for LauncherRequestStream {
638    fn is_terminated(&self) -> bool {
639        self.is_terminated
640    }
641}
642
643impl fidl::endpoints::RequestStream for LauncherRequestStream {
644    type Protocol = LauncherMarker;
645    type ControlHandle = LauncherControlHandle;
646
647    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
648        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
649    }
650
651    fn control_handle(&self) -> Self::ControlHandle {
652        LauncherControlHandle { inner: self.inner.clone() }
653    }
654
655    fn into_inner(
656        self,
657    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
658    {
659        (self.inner, self.is_terminated)
660    }
661
662    fn from_inner(
663        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
664        is_terminated: bool,
665    ) -> Self {
666        Self { inner, is_terminated }
667    }
668}
669
670impl futures::Stream for LauncherRequestStream {
671    type Item = Result<LauncherRequest, fidl::Error>;
672
673    fn poll_next(
674        mut self: std::pin::Pin<&mut Self>,
675        cx: &mut std::task::Context<'_>,
676    ) -> std::task::Poll<Option<Self::Item>> {
677        let this = &mut *self;
678        if this.inner.check_shutdown(cx) {
679            this.is_terminated = true;
680            return std::task::Poll::Ready(None);
681        }
682        if this.is_terminated {
683            panic!("polled LauncherRequestStream after completion");
684        }
685        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
686            |bytes, handles| {
687                match this.inner.channel().read_etc(cx, bytes, handles) {
688                    std::task::Poll::Ready(Ok(())) => {}
689                    std::task::Poll::Pending => return std::task::Poll::Pending,
690                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
691                        this.is_terminated = true;
692                        return std::task::Poll::Ready(None);
693                    }
694                    std::task::Poll::Ready(Err(e)) => {
695                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
696                            e.into(),
697                        ))))
698                    }
699                }
700
701                // A message has been received from the channel
702                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
703
704                std::task::Poll::Ready(Some(match header.ordinal {
705                    0x11335a9928afbfa4 => {
706                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
707                        let mut req = fidl::new_empty!(
708                            LauncherLaunchRequest,
709                            fidl::encoding::DefaultFuchsiaResourceDialect
710                        );
711                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LauncherLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
712                        let control_handle = LauncherControlHandle { inner: this.inner.clone() };
713                        Ok(LauncherRequest::Launch {
714                            info: req.info,
715
716                            responder: LauncherLaunchResponder {
717                                control_handle: std::mem::ManuallyDrop::new(control_handle),
718                                tx_id: header.tx_id,
719                            },
720                        })
721                    }
722                    0x755f8263fe51cb61 => {
723                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
724                        let mut req = fidl::new_empty!(
725                            LauncherCreateWithoutStartingRequest,
726                            fidl::encoding::DefaultFuchsiaResourceDialect
727                        );
728                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LauncherCreateWithoutStartingRequest>(&header, _body_bytes, handles, &mut req)?;
729                        let control_handle = LauncherControlHandle { inner: this.inner.clone() };
730                        Ok(LauncherRequest::CreateWithoutStarting {
731                            info: req.info,
732
733                            responder: LauncherCreateWithoutStartingResponder {
734                                control_handle: std::mem::ManuallyDrop::new(control_handle),
735                                tx_id: header.tx_id,
736                            },
737                        })
738                    }
739                    0x3be445d3e4fd6512 => {
740                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
741                        let mut req = fidl::new_empty!(
742                            LauncherAddArgsRequest,
743                            fidl::encoding::DefaultFuchsiaResourceDialect
744                        );
745                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LauncherAddArgsRequest>(&header, _body_bytes, handles, &mut req)?;
746                        let control_handle = LauncherControlHandle { inner: this.inner.clone() };
747                        Ok(LauncherRequest::AddArgs { args: req.args, control_handle })
748                    }
749                    0x73a3c97fa7fe1779 => {
750                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
751                        let mut req = fidl::new_empty!(
752                            LauncherAddEnvironsRequest,
753                            fidl::encoding::DefaultFuchsiaResourceDialect
754                        );
755                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LauncherAddEnvironsRequest>(&header, _body_bytes, handles, &mut req)?;
756                        let control_handle = LauncherControlHandle { inner: this.inner.clone() };
757                        Ok(LauncherRequest::AddEnvirons { environ: req.environ, control_handle })
758                    }
759                    0x2579ee2c7be28662 => {
760                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
761                        let mut req = fidl::new_empty!(
762                            LauncherAddNamesRequest,
763                            fidl::encoding::DefaultFuchsiaResourceDialect
764                        );
765                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LauncherAddNamesRequest>(&header, _body_bytes, handles, &mut req)?;
766                        let control_handle = LauncherControlHandle { inner: this.inner.clone() };
767                        Ok(LauncherRequest::AddNames { names: req.names, control_handle })
768                    }
769                    0x51025267a537a615 => {
770                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
771                        let mut req = fidl::new_empty!(
772                            LauncherAddHandlesRequest,
773                            fidl::encoding::DefaultFuchsiaResourceDialect
774                        );
775                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LauncherAddHandlesRequest>(&header, _body_bytes, handles, &mut req)?;
776                        let control_handle = LauncherControlHandle { inner: this.inner.clone() };
777                        Ok(LauncherRequest::AddHandles { handles: req.handles, control_handle })
778                    }
779                    0x5b92576147ebfd87 => {
780                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
781                        let mut req = fidl::new_empty!(
782                            LauncherSetOptionsRequest,
783                            fidl::encoding::DefaultFuchsiaResourceDialect
784                        );
785                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LauncherSetOptionsRequest>(&header, _body_bytes, handles, &mut req)?;
786                        let control_handle = LauncherControlHandle { inner: this.inner.clone() };
787                        Ok(LauncherRequest::SetOptions { options: req.options, control_handle })
788                    }
789                    _ => Err(fidl::Error::UnknownOrdinal {
790                        ordinal: header.ordinal,
791                        protocol_name:
792                            <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
793                    }),
794                }))
795            },
796        )
797    }
798}
799
800/// A low-level interface for launching processes.
801///
802/// This interface is used for manually assembling a process. The caller supplies
803/// all the capabilities for the newly created process.
804///
805/// That create processes typically use `fdio_spawn` or `fdio_spawn_etc` rather
806/// than using this interface directly. The `fdio_spawn` and `fdio_spawn_etc`
807/// functions are implemented using this interface.
808///
809/// Debuggers and other clients that need to create processes in a suspended
810/// state often use this interface directly. These clients use the
811/// `CreateWithoutStarting` method to create the process without actually
812/// starting it.
813#[derive(Debug)]
814pub enum LauncherRequest {
815    /// Creates and starts the process described by `info`.
816    ///
817    /// After processing this message, the `Launcher` is reset to its initial
818    /// state and is ready to launch another process.
819    ///
820    /// `process` is present if, and only if, `status` is `ZX_OK`.
821    Launch { info: LaunchInfo, responder: LauncherLaunchResponder },
822    /// Creates the process described by `info` but does not start it.
823    ///
824    /// After processing this message, the `Launcher` is reset to its initial
825    /// state and is ready to launch another process.
826    ///
827    /// The caller is responsible for calling `zx_process_start` using the data
828    /// in `ProcessStartData` to actually start the process.
829    ///
830    /// `data` is present if, and only if, `status` is `ZX_OK`.
831    CreateWithoutStarting { info: LaunchInfo, responder: LauncherCreateWithoutStartingResponder },
832    /// Adds the given arguments to the command-line for the process.
833    ///
834    /// Calling this method multiple times concatenates the arguments.
835    AddArgs { args: Vec<Vec<u8>>, control_handle: LauncherControlHandle },
836    /// Adds the given variables to the environment variables for the process.
837    ///
838    /// Calling this method multiple times concatenates the variables.
839    AddEnvirons { environ: Vec<Vec<u8>>, control_handle: LauncherControlHandle },
840    /// Adds the given names to the namespace for the process.
841    ///
842    /// The paths in the namespace must be non-overlapping. See
843    /// <https://fuchsia.dev/fuchsia-src/concepts/process/namespaces> for details.
844    ///
845    /// Calling this method multiple times concatenates the names.
846    AddNames { names: Vec<NameInfo>, control_handle: LauncherControlHandle },
847    /// Adds the given handles to the startup handles for the process.
848    ///
849    /// Calling this method multiple times concatenates the handles.
850    AddHandles { handles: Vec<HandleInfo>, control_handle: LauncherControlHandle },
851    /// Sets the options with which the process is created.
852    ///
853    /// Calling this method multiple times will overwrite the current options.
854    SetOptions { options: u32, control_handle: LauncherControlHandle },
855}
856
857impl LauncherRequest {
858    #[allow(irrefutable_let_patterns)]
859    pub fn into_launch(self) -> Option<(LaunchInfo, LauncherLaunchResponder)> {
860        if let LauncherRequest::Launch { info, responder } = self {
861            Some((info, responder))
862        } else {
863            None
864        }
865    }
866
867    #[allow(irrefutable_let_patterns)]
868    pub fn into_create_without_starting(
869        self,
870    ) -> Option<(LaunchInfo, LauncherCreateWithoutStartingResponder)> {
871        if let LauncherRequest::CreateWithoutStarting { info, responder } = self {
872            Some((info, responder))
873        } else {
874            None
875        }
876    }
877
878    #[allow(irrefutable_let_patterns)]
879    pub fn into_add_args(self) -> Option<(Vec<Vec<u8>>, LauncherControlHandle)> {
880        if let LauncherRequest::AddArgs { args, control_handle } = self {
881            Some((args, control_handle))
882        } else {
883            None
884        }
885    }
886
887    #[allow(irrefutable_let_patterns)]
888    pub fn into_add_environs(self) -> Option<(Vec<Vec<u8>>, LauncherControlHandle)> {
889        if let LauncherRequest::AddEnvirons { environ, control_handle } = self {
890            Some((environ, control_handle))
891        } else {
892            None
893        }
894    }
895
896    #[allow(irrefutable_let_patterns)]
897    pub fn into_add_names(self) -> Option<(Vec<NameInfo>, LauncherControlHandle)> {
898        if let LauncherRequest::AddNames { names, control_handle } = self {
899            Some((names, control_handle))
900        } else {
901            None
902        }
903    }
904
905    #[allow(irrefutable_let_patterns)]
906    pub fn into_add_handles(self) -> Option<(Vec<HandleInfo>, LauncherControlHandle)> {
907        if let LauncherRequest::AddHandles { handles, control_handle } = self {
908            Some((handles, control_handle))
909        } else {
910            None
911        }
912    }
913
914    #[allow(irrefutable_let_patterns)]
915    pub fn into_set_options(self) -> Option<(u32, LauncherControlHandle)> {
916        if let LauncherRequest::SetOptions { options, control_handle } = self {
917            Some((options, control_handle))
918        } else {
919            None
920        }
921    }
922
923    /// Name of the method defined in FIDL
924    pub fn method_name(&self) -> &'static str {
925        match *self {
926            LauncherRequest::Launch { .. } => "launch",
927            LauncherRequest::CreateWithoutStarting { .. } => "create_without_starting",
928            LauncherRequest::AddArgs { .. } => "add_args",
929            LauncherRequest::AddEnvirons { .. } => "add_environs",
930            LauncherRequest::AddNames { .. } => "add_names",
931            LauncherRequest::AddHandles { .. } => "add_handles",
932            LauncherRequest::SetOptions { .. } => "set_options",
933        }
934    }
935}
936
937#[derive(Debug, Clone)]
938pub struct LauncherControlHandle {
939    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
940}
941
942impl fidl::endpoints::ControlHandle for LauncherControlHandle {
943    fn shutdown(&self) {
944        self.inner.shutdown()
945    }
946    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
947        self.inner.shutdown_with_epitaph(status)
948    }
949
950    fn is_closed(&self) -> bool {
951        self.inner.channel().is_closed()
952    }
953    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
954        self.inner.channel().on_closed()
955    }
956
957    #[cfg(target_os = "fuchsia")]
958    fn signal_peer(
959        &self,
960        clear_mask: zx::Signals,
961        set_mask: zx::Signals,
962    ) -> Result<(), zx_status::Status> {
963        use fidl::Peered;
964        self.inner.channel().signal_peer(clear_mask, set_mask)
965    }
966}
967
968impl LauncherControlHandle {}
969
970#[must_use = "FIDL methods require a response to be sent"]
971#[derive(Debug)]
972pub struct LauncherLaunchResponder {
973    control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
974    tx_id: u32,
975}
976
977/// Set the the channel to be shutdown (see [`LauncherControlHandle::shutdown`])
978/// if the responder is dropped without sending a response, so that the client
979/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
980impl std::ops::Drop for LauncherLaunchResponder {
981    fn drop(&mut self) {
982        self.control_handle.shutdown();
983        // Safety: drops once, never accessed again
984        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
985    }
986}
987
988impl fidl::endpoints::Responder for LauncherLaunchResponder {
989    type ControlHandle = LauncherControlHandle;
990
991    fn control_handle(&self) -> &LauncherControlHandle {
992        &self.control_handle
993    }
994
995    fn drop_without_shutdown(mut self) {
996        // Safety: drops once, never accessed again due to mem::forget
997        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
998        // Prevent Drop from running (which would shut down the channel)
999        std::mem::forget(self);
1000    }
1001}
1002
1003impl LauncherLaunchResponder {
1004    /// Sends a response to the FIDL transaction.
1005    ///
1006    /// Sets the channel to shutdown if an error occurs.
1007    pub fn send(
1008        self,
1009        mut status: i32,
1010        mut process: Option<fidl::Process>,
1011    ) -> Result<(), fidl::Error> {
1012        let _result = self.send_raw(status, process);
1013        if _result.is_err() {
1014            self.control_handle.shutdown();
1015        }
1016        self.drop_without_shutdown();
1017        _result
1018    }
1019
1020    /// Similar to "send" but does not shutdown the channel if an error occurs.
1021    pub fn send_no_shutdown_on_err(
1022        self,
1023        mut status: i32,
1024        mut process: Option<fidl::Process>,
1025    ) -> Result<(), fidl::Error> {
1026        let _result = self.send_raw(status, process);
1027        self.drop_without_shutdown();
1028        _result
1029    }
1030
1031    fn send_raw(
1032        &self,
1033        mut status: i32,
1034        mut process: Option<fidl::Process>,
1035    ) -> Result<(), fidl::Error> {
1036        self.control_handle.inner.send::<LauncherLaunchResponse>(
1037            (status, process),
1038            self.tx_id,
1039            0x11335a9928afbfa4,
1040            fidl::encoding::DynamicFlags::empty(),
1041        )
1042    }
1043}
1044
1045#[must_use = "FIDL methods require a response to be sent"]
1046#[derive(Debug)]
1047pub struct LauncherCreateWithoutStartingResponder {
1048    control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
1049    tx_id: u32,
1050}
1051
1052/// Set the the channel to be shutdown (see [`LauncherControlHandle::shutdown`])
1053/// if the responder is dropped without sending a response, so that the client
1054/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1055impl std::ops::Drop for LauncherCreateWithoutStartingResponder {
1056    fn drop(&mut self) {
1057        self.control_handle.shutdown();
1058        // Safety: drops once, never accessed again
1059        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1060    }
1061}
1062
1063impl fidl::endpoints::Responder for LauncherCreateWithoutStartingResponder {
1064    type ControlHandle = LauncherControlHandle;
1065
1066    fn control_handle(&self) -> &LauncherControlHandle {
1067        &self.control_handle
1068    }
1069
1070    fn drop_without_shutdown(mut self) {
1071        // Safety: drops once, never accessed again due to mem::forget
1072        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1073        // Prevent Drop from running (which would shut down the channel)
1074        std::mem::forget(self);
1075    }
1076}
1077
1078impl LauncherCreateWithoutStartingResponder {
1079    /// Sends a response to the FIDL transaction.
1080    ///
1081    /// Sets the channel to shutdown if an error occurs.
1082    pub fn send(
1083        self,
1084        mut status: i32,
1085        mut data: Option<ProcessStartData>,
1086    ) -> Result<(), fidl::Error> {
1087        let _result = self.send_raw(status, data);
1088        if _result.is_err() {
1089            self.control_handle.shutdown();
1090        }
1091        self.drop_without_shutdown();
1092        _result
1093    }
1094
1095    /// Similar to "send" but does not shutdown the channel if an error occurs.
1096    pub fn send_no_shutdown_on_err(
1097        self,
1098        mut status: i32,
1099        mut data: Option<ProcessStartData>,
1100    ) -> Result<(), fidl::Error> {
1101        let _result = self.send_raw(status, data);
1102        self.drop_without_shutdown();
1103        _result
1104    }
1105
1106    fn send_raw(
1107        &self,
1108        mut status: i32,
1109        mut data: Option<ProcessStartData>,
1110    ) -> Result<(), fidl::Error> {
1111        self.control_handle.inner.send::<LauncherCreateWithoutStartingResponse>(
1112            (status, data.as_mut()),
1113            self.tx_id,
1114            0x755f8263fe51cb61,
1115            fidl::encoding::DynamicFlags::empty(),
1116        )
1117    }
1118}
1119
1120#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1121pub struct ResolverMarker;
1122
1123impl fidl::endpoints::ProtocolMarker for ResolverMarker {
1124    type Proxy = ResolverProxy;
1125    type RequestStream = ResolverRequestStream;
1126    #[cfg(target_os = "fuchsia")]
1127    type SynchronousProxy = ResolverSynchronousProxy;
1128
1129    const DEBUG_NAME: &'static str = "fuchsia.process.Resolver";
1130}
1131impl fidl::endpoints::DiscoverableProtocolMarker for ResolverMarker {}
1132
1133pub trait ResolverProxyInterface: Send + Sync {
1134    type ResolveResponseFut: std::future::Future<
1135            Output = Result<
1136                (
1137                    i32,
1138                    Option<fidl::Vmo>,
1139                    Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
1140                ),
1141                fidl::Error,
1142            >,
1143        > + Send;
1144    fn r#resolve(&self, name: &str) -> Self::ResolveResponseFut;
1145}
1146#[derive(Debug)]
1147#[cfg(target_os = "fuchsia")]
1148pub struct ResolverSynchronousProxy {
1149    client: fidl::client::sync::Client,
1150}
1151
1152#[cfg(target_os = "fuchsia")]
1153impl fidl::endpoints::SynchronousProxy for ResolverSynchronousProxy {
1154    type Proxy = ResolverProxy;
1155    type Protocol = ResolverMarker;
1156
1157    fn from_channel(inner: fidl::Channel) -> Self {
1158        Self::new(inner)
1159    }
1160
1161    fn into_channel(self) -> fidl::Channel {
1162        self.client.into_channel()
1163    }
1164
1165    fn as_channel(&self) -> &fidl::Channel {
1166        self.client.as_channel()
1167    }
1168}
1169
1170#[cfg(target_os = "fuchsia")]
1171impl ResolverSynchronousProxy {
1172    pub fn new(channel: fidl::Channel) -> Self {
1173        let protocol_name = <ResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1174        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1175    }
1176
1177    pub fn into_channel(self) -> fidl::Channel {
1178        self.client.into_channel()
1179    }
1180
1181    /// Waits until an event arrives and returns it. It is safe for other
1182    /// threads to make concurrent requests while waiting for an event.
1183    pub fn wait_for_event(
1184        &self,
1185        deadline: zx::MonotonicInstant,
1186    ) -> Result<ResolverEvent, fidl::Error> {
1187        ResolverEvent::decode(self.client.wait_for_event(deadline)?)
1188    }
1189
1190    /// Resolves the given `name` to an `executable` and an shared library
1191    /// loader.
1192    ///
1193    /// If present, the `executable` is suitable for use as the `executable`
1194    /// property of `LaunchInfo` -- in particular, it will have `ZX_RIGHT_EXECUTE`.
1195    /// If present, the `ldsvc` is suitable for use as the `PA_LDSVC_LOADER`
1196    /// handle when launching the process.
1197    ///
1198    /// For example, the resolver might locate the given `name` inside a package
1199    /// and return the executable binary from the package as well as a shared
1200    /// library loader scoped to that package.
1201    pub fn r#resolve(
1202        &self,
1203        mut name: &str,
1204        ___deadline: zx::MonotonicInstant,
1205    ) -> Result<
1206        (
1207            i32,
1208            Option<fidl::Vmo>,
1209            Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
1210        ),
1211        fidl::Error,
1212    > {
1213        let _response = self.client.send_query::<ResolverResolveRequest, ResolverResolveResponse>(
1214            (name,),
1215            0x3c15951efde89c90,
1216            fidl::encoding::DynamicFlags::empty(),
1217            ___deadline,
1218        )?;
1219        Ok((_response.status, _response.executable, _response.ldsvc))
1220    }
1221}
1222
1223#[derive(Debug, Clone)]
1224pub struct ResolverProxy {
1225    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1226}
1227
1228impl fidl::endpoints::Proxy for ResolverProxy {
1229    type Protocol = ResolverMarker;
1230
1231    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1232        Self::new(inner)
1233    }
1234
1235    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1236        self.client.into_channel().map_err(|client| Self { client })
1237    }
1238
1239    fn as_channel(&self) -> &::fidl::AsyncChannel {
1240        self.client.as_channel()
1241    }
1242}
1243
1244impl ResolverProxy {
1245    /// Create a new Proxy for fuchsia.process/Resolver.
1246    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1247        let protocol_name = <ResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1248        Self { client: fidl::client::Client::new(channel, protocol_name) }
1249    }
1250
1251    /// Get a Stream of events from the remote end of the protocol.
1252    ///
1253    /// # Panics
1254    ///
1255    /// Panics if the event stream was already taken.
1256    pub fn take_event_stream(&self) -> ResolverEventStream {
1257        ResolverEventStream { event_receiver: self.client.take_event_receiver() }
1258    }
1259
1260    /// Resolves the given `name` to an `executable` and an shared library
1261    /// loader.
1262    ///
1263    /// If present, the `executable` is suitable for use as the `executable`
1264    /// property of `LaunchInfo` -- in particular, it will have `ZX_RIGHT_EXECUTE`.
1265    /// If present, the `ldsvc` is suitable for use as the `PA_LDSVC_LOADER`
1266    /// handle when launching the process.
1267    ///
1268    /// For example, the resolver might locate the given `name` inside a package
1269    /// and return the executable binary from the package as well as a shared
1270    /// library loader scoped to that package.
1271    pub fn r#resolve(
1272        &self,
1273        mut name: &str,
1274    ) -> fidl::client::QueryResponseFut<
1275        (
1276            i32,
1277            Option<fidl::Vmo>,
1278            Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
1279        ),
1280        fidl::encoding::DefaultFuchsiaResourceDialect,
1281    > {
1282        ResolverProxyInterface::r#resolve(self, name)
1283    }
1284}
1285
1286impl ResolverProxyInterface for ResolverProxy {
1287    type ResolveResponseFut = fidl::client::QueryResponseFut<
1288        (
1289            i32,
1290            Option<fidl::Vmo>,
1291            Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
1292        ),
1293        fidl::encoding::DefaultFuchsiaResourceDialect,
1294    >;
1295    fn r#resolve(&self, mut name: &str) -> Self::ResolveResponseFut {
1296        fn _decode(
1297            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1298        ) -> Result<
1299            (
1300                i32,
1301                Option<fidl::Vmo>,
1302                Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
1303            ),
1304            fidl::Error,
1305        > {
1306            let _response = fidl::client::decode_transaction_body::<
1307                ResolverResolveResponse,
1308                fidl::encoding::DefaultFuchsiaResourceDialect,
1309                0x3c15951efde89c90,
1310            >(_buf?)?;
1311            Ok((_response.status, _response.executable, _response.ldsvc))
1312        }
1313        self.client.send_query_and_decode::<ResolverResolveRequest, (
1314            i32,
1315            Option<fidl::Vmo>,
1316            Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
1317        )>(
1318            (name,), 0x3c15951efde89c90, fidl::encoding::DynamicFlags::empty(), _decode
1319        )
1320    }
1321}
1322
1323pub struct ResolverEventStream {
1324    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1325}
1326
1327impl std::marker::Unpin for ResolverEventStream {}
1328
1329impl futures::stream::FusedStream for ResolverEventStream {
1330    fn is_terminated(&self) -> bool {
1331        self.event_receiver.is_terminated()
1332    }
1333}
1334
1335impl futures::Stream for ResolverEventStream {
1336    type Item = Result<ResolverEvent, fidl::Error>;
1337
1338    fn poll_next(
1339        mut self: std::pin::Pin<&mut Self>,
1340        cx: &mut std::task::Context<'_>,
1341    ) -> std::task::Poll<Option<Self::Item>> {
1342        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1343            &mut self.event_receiver,
1344            cx
1345        )?) {
1346            Some(buf) => std::task::Poll::Ready(Some(ResolverEvent::decode(buf))),
1347            None => std::task::Poll::Ready(None),
1348        }
1349    }
1350}
1351
1352#[derive(Debug)]
1353pub enum ResolverEvent {}
1354
1355impl ResolverEvent {
1356    /// Decodes a message buffer as a [`ResolverEvent`].
1357    fn decode(
1358        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1359    ) -> Result<ResolverEvent, fidl::Error> {
1360        let (bytes, _handles) = buf.split_mut();
1361        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1362        debug_assert_eq!(tx_header.tx_id, 0);
1363        match tx_header.ordinal {
1364            _ => Err(fidl::Error::UnknownOrdinal {
1365                ordinal: tx_header.ordinal,
1366                protocol_name: <ResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1367            }),
1368        }
1369    }
1370}
1371
1372/// A Stream of incoming requests for fuchsia.process/Resolver.
1373pub struct ResolverRequestStream {
1374    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1375    is_terminated: bool,
1376}
1377
1378impl std::marker::Unpin for ResolverRequestStream {}
1379
1380impl futures::stream::FusedStream for ResolverRequestStream {
1381    fn is_terminated(&self) -> bool {
1382        self.is_terminated
1383    }
1384}
1385
1386impl fidl::endpoints::RequestStream for ResolverRequestStream {
1387    type Protocol = ResolverMarker;
1388    type ControlHandle = ResolverControlHandle;
1389
1390    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1391        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1392    }
1393
1394    fn control_handle(&self) -> Self::ControlHandle {
1395        ResolverControlHandle { inner: self.inner.clone() }
1396    }
1397
1398    fn into_inner(
1399        self,
1400    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1401    {
1402        (self.inner, self.is_terminated)
1403    }
1404
1405    fn from_inner(
1406        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1407        is_terminated: bool,
1408    ) -> Self {
1409        Self { inner, is_terminated }
1410    }
1411}
1412
1413impl futures::Stream for ResolverRequestStream {
1414    type Item = Result<ResolverRequest, fidl::Error>;
1415
1416    fn poll_next(
1417        mut self: std::pin::Pin<&mut Self>,
1418        cx: &mut std::task::Context<'_>,
1419    ) -> std::task::Poll<Option<Self::Item>> {
1420        let this = &mut *self;
1421        if this.inner.check_shutdown(cx) {
1422            this.is_terminated = true;
1423            return std::task::Poll::Ready(None);
1424        }
1425        if this.is_terminated {
1426            panic!("polled ResolverRequestStream after completion");
1427        }
1428        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1429            |bytes, handles| {
1430                match this.inner.channel().read_etc(cx, bytes, handles) {
1431                    std::task::Poll::Ready(Ok(())) => {}
1432                    std::task::Poll::Pending => return std::task::Poll::Pending,
1433                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1434                        this.is_terminated = true;
1435                        return std::task::Poll::Ready(None);
1436                    }
1437                    std::task::Poll::Ready(Err(e)) => {
1438                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1439                            e.into(),
1440                        ))))
1441                    }
1442                }
1443
1444                // A message has been received from the channel
1445                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1446
1447                std::task::Poll::Ready(Some(match header.ordinal {
1448                    0x3c15951efde89c90 => {
1449                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1450                        let mut req = fidl::new_empty!(
1451                            ResolverResolveRequest,
1452                            fidl::encoding::DefaultFuchsiaResourceDialect
1453                        );
1454                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ResolverResolveRequest>(&header, _body_bytes, handles, &mut req)?;
1455                        let control_handle = ResolverControlHandle { inner: this.inner.clone() };
1456                        Ok(ResolverRequest::Resolve {
1457                            name: req.name,
1458
1459                            responder: ResolverResolveResponder {
1460                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1461                                tx_id: header.tx_id,
1462                            },
1463                        })
1464                    }
1465                    _ => Err(fidl::Error::UnknownOrdinal {
1466                        ordinal: header.ordinal,
1467                        protocol_name:
1468                            <ResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1469                    }),
1470                }))
1471            },
1472        )
1473    }
1474}
1475
1476/// An interface for resolving names to executables and library loaders.
1477///
1478/// An executable itself is often not sufficient to create a working process
1479/// because many executables also load shared libraries. On Fuchsia, there is no
1480/// global pool of shared libraries. Instead, every process has an associated
1481/// `fuchsia.ldsvc.Loader`, which provides access to a private pool of shared
1482/// libraries appropriate for that process.
1483///
1484/// This interface provides a protocol for resolving a name into both the
1485/// `zx.Handle:VMO` for the executable and the `fuchsia.ldsvc.Loader` for its
1486/// associated shared libraries.
1487///
1488/// This interface is rarely used directly. Instead, `fdio_spawn` and
1489/// `fdio_spawn_etc` use this interface internally when they try to run a file
1490/// with a `#!resolve` directive.
1491#[derive(Debug)]
1492pub enum ResolverRequest {
1493    /// Resolves the given `name` to an `executable` and an shared library
1494    /// loader.
1495    ///
1496    /// If present, the `executable` is suitable for use as the `executable`
1497    /// property of `LaunchInfo` -- in particular, it will have `ZX_RIGHT_EXECUTE`.
1498    /// If present, the `ldsvc` is suitable for use as the `PA_LDSVC_LOADER`
1499    /// handle when launching the process.
1500    ///
1501    /// For example, the resolver might locate the given `name` inside a package
1502    /// and return the executable binary from the package as well as a shared
1503    /// library loader scoped to that package.
1504    Resolve { name: String, responder: ResolverResolveResponder },
1505}
1506
1507impl ResolverRequest {
1508    #[allow(irrefutable_let_patterns)]
1509    pub fn into_resolve(self) -> Option<(String, ResolverResolveResponder)> {
1510        if let ResolverRequest::Resolve { name, responder } = self {
1511            Some((name, responder))
1512        } else {
1513            None
1514        }
1515    }
1516
1517    /// Name of the method defined in FIDL
1518    pub fn method_name(&self) -> &'static str {
1519        match *self {
1520            ResolverRequest::Resolve { .. } => "resolve",
1521        }
1522    }
1523}
1524
1525#[derive(Debug, Clone)]
1526pub struct ResolverControlHandle {
1527    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1528}
1529
1530impl fidl::endpoints::ControlHandle for ResolverControlHandle {
1531    fn shutdown(&self) {
1532        self.inner.shutdown()
1533    }
1534    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1535        self.inner.shutdown_with_epitaph(status)
1536    }
1537
1538    fn is_closed(&self) -> bool {
1539        self.inner.channel().is_closed()
1540    }
1541    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1542        self.inner.channel().on_closed()
1543    }
1544
1545    #[cfg(target_os = "fuchsia")]
1546    fn signal_peer(
1547        &self,
1548        clear_mask: zx::Signals,
1549        set_mask: zx::Signals,
1550    ) -> Result<(), zx_status::Status> {
1551        use fidl::Peered;
1552        self.inner.channel().signal_peer(clear_mask, set_mask)
1553    }
1554}
1555
1556impl ResolverControlHandle {}
1557
1558#[must_use = "FIDL methods require a response to be sent"]
1559#[derive(Debug)]
1560pub struct ResolverResolveResponder {
1561    control_handle: std::mem::ManuallyDrop<ResolverControlHandle>,
1562    tx_id: u32,
1563}
1564
1565/// Set the the channel to be shutdown (see [`ResolverControlHandle::shutdown`])
1566/// if the responder is dropped without sending a response, so that the client
1567/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1568impl std::ops::Drop for ResolverResolveResponder {
1569    fn drop(&mut self) {
1570        self.control_handle.shutdown();
1571        // Safety: drops once, never accessed again
1572        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1573    }
1574}
1575
1576impl fidl::endpoints::Responder for ResolverResolveResponder {
1577    type ControlHandle = ResolverControlHandle;
1578
1579    fn control_handle(&self) -> &ResolverControlHandle {
1580        &self.control_handle
1581    }
1582
1583    fn drop_without_shutdown(mut self) {
1584        // Safety: drops once, never accessed again due to mem::forget
1585        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1586        // Prevent Drop from running (which would shut down the channel)
1587        std::mem::forget(self);
1588    }
1589}
1590
1591impl ResolverResolveResponder {
1592    /// Sends a response to the FIDL transaction.
1593    ///
1594    /// Sets the channel to shutdown if an error occurs.
1595    pub fn send(
1596        self,
1597        mut status: i32,
1598        mut executable: Option<fidl::Vmo>,
1599        mut ldsvc: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
1600    ) -> Result<(), fidl::Error> {
1601        let _result = self.send_raw(status, executable, ldsvc);
1602        if _result.is_err() {
1603            self.control_handle.shutdown();
1604        }
1605        self.drop_without_shutdown();
1606        _result
1607    }
1608
1609    /// Similar to "send" but does not shutdown the channel if an error occurs.
1610    pub fn send_no_shutdown_on_err(
1611        self,
1612        mut status: i32,
1613        mut executable: Option<fidl::Vmo>,
1614        mut ldsvc: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
1615    ) -> Result<(), fidl::Error> {
1616        let _result = self.send_raw(status, executable, ldsvc);
1617        self.drop_without_shutdown();
1618        _result
1619    }
1620
1621    fn send_raw(
1622        &self,
1623        mut status: i32,
1624        mut executable: Option<fidl::Vmo>,
1625        mut ldsvc: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
1626    ) -> Result<(), fidl::Error> {
1627        self.control_handle.inner.send::<ResolverResolveResponse>(
1628            (status, executable, ldsvc),
1629            self.tx_id,
1630            0x3c15951efde89c90,
1631            fidl::encoding::DynamicFlags::empty(),
1632        )
1633    }
1634}
1635
1636mod internal {
1637    use super::*;
1638
1639    impl fidl::encoding::ResourceTypeMarker for HandleInfo {
1640        type Borrowed<'a> = &'a mut Self;
1641        fn take_or_borrow<'a>(
1642            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1643        ) -> Self::Borrowed<'a> {
1644            value
1645        }
1646    }
1647
1648    unsafe impl fidl::encoding::TypeMarker for HandleInfo {
1649        type Owned = Self;
1650
1651        #[inline(always)]
1652        fn inline_align(_context: fidl::encoding::Context) -> usize {
1653            4
1654        }
1655
1656        #[inline(always)]
1657        fn inline_size(_context: fidl::encoding::Context) -> usize {
1658            8
1659        }
1660    }
1661
1662    unsafe impl fidl::encoding::Encode<HandleInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
1663        for &mut HandleInfo
1664    {
1665        #[inline]
1666        unsafe fn encode(
1667            self,
1668            encoder: &mut fidl::encoding::Encoder<
1669                '_,
1670                fidl::encoding::DefaultFuchsiaResourceDialect,
1671            >,
1672            offset: usize,
1673            _depth: fidl::encoding::Depth,
1674        ) -> fidl::Result<()> {
1675            encoder.debug_check_bounds::<HandleInfo>(offset);
1676            // Delegate to tuple encoding.
1677            fidl::encoding::Encode::<HandleInfo, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1678                (
1679                    <fidl::encoding::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
1680                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1681                ),
1682                encoder, offset, _depth
1683            )
1684        }
1685    }
1686    unsafe impl<
1687            T0: fidl::encoding::Encode<
1688                fidl::encoding::HandleType<
1689                    fidl::Handle,
1690                    { fidl::ObjectType::NONE.into_raw() },
1691                    2147483648,
1692                >,
1693                fidl::encoding::DefaultFuchsiaResourceDialect,
1694            >,
1695            T1: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
1696        > fidl::encoding::Encode<HandleInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
1697        for (T0, T1)
1698    {
1699        #[inline]
1700        unsafe fn encode(
1701            self,
1702            encoder: &mut fidl::encoding::Encoder<
1703                '_,
1704                fidl::encoding::DefaultFuchsiaResourceDialect,
1705            >,
1706            offset: usize,
1707            depth: fidl::encoding::Depth,
1708        ) -> fidl::Result<()> {
1709            encoder.debug_check_bounds::<HandleInfo>(offset);
1710            // Zero out padding regions. There's no need to apply masks
1711            // because the unmasked parts will be overwritten by fields.
1712            // Write the fields.
1713            self.0.encode(encoder, offset + 0, depth)?;
1714            self.1.encode(encoder, offset + 4, depth)?;
1715            Ok(())
1716        }
1717    }
1718
1719    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for HandleInfo {
1720        #[inline(always)]
1721        fn new_empty() -> Self {
1722            Self {
1723                handle: fidl::new_empty!(fidl::encoding::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1724                id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
1725            }
1726        }
1727
1728        #[inline]
1729        unsafe fn decode(
1730            &mut self,
1731            decoder: &mut fidl::encoding::Decoder<
1732                '_,
1733                fidl::encoding::DefaultFuchsiaResourceDialect,
1734            >,
1735            offset: usize,
1736            _depth: fidl::encoding::Depth,
1737        ) -> fidl::Result<()> {
1738            decoder.debug_check_bounds::<Self>(offset);
1739            // Verify that padding bytes are zero.
1740            fidl::decode!(fidl::encoding::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.handle, decoder, offset + 0, _depth)?;
1741            fidl::decode!(
1742                u32,
1743                fidl::encoding::DefaultFuchsiaResourceDialect,
1744                &mut self.id,
1745                decoder,
1746                offset + 4,
1747                _depth
1748            )?;
1749            Ok(())
1750        }
1751    }
1752
1753    impl fidl::encoding::ResourceTypeMarker for LaunchInfo {
1754        type Borrowed<'a> = &'a mut Self;
1755        fn take_or_borrow<'a>(
1756            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1757        ) -> Self::Borrowed<'a> {
1758            value
1759        }
1760    }
1761
1762    unsafe impl fidl::encoding::TypeMarker for LaunchInfo {
1763        type Owned = Self;
1764
1765        #[inline(always)]
1766        fn inline_align(_context: fidl::encoding::Context) -> usize {
1767            8
1768        }
1769
1770        #[inline(always)]
1771        fn inline_size(_context: fidl::encoding::Context) -> usize {
1772            24
1773        }
1774    }
1775
1776    unsafe impl fidl::encoding::Encode<LaunchInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
1777        for &mut LaunchInfo
1778    {
1779        #[inline]
1780        unsafe fn encode(
1781            self,
1782            encoder: &mut fidl::encoding::Encoder<
1783                '_,
1784                fidl::encoding::DefaultFuchsiaResourceDialect,
1785            >,
1786            offset: usize,
1787            _depth: fidl::encoding::Depth,
1788        ) -> fidl::Result<()> {
1789            encoder.debug_check_bounds::<LaunchInfo>(offset);
1790            // Delegate to tuple encoding.
1791            fidl::encoding::Encode::<LaunchInfo, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1792                (
1793                    <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.executable),
1794                    <fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.job),
1795                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
1796                ),
1797                encoder, offset, _depth
1798            )
1799        }
1800    }
1801    unsafe impl<
1802            T0: fidl::encoding::Encode<
1803                fidl::encoding::HandleType<
1804                    fidl::Vmo,
1805                    { fidl::ObjectType::VMO.into_raw() },
1806                    2147483648,
1807                >,
1808                fidl::encoding::DefaultFuchsiaResourceDialect,
1809            >,
1810            T1: fidl::encoding::Encode<
1811                fidl::encoding::HandleType<
1812                    fidl::Job,
1813                    { fidl::ObjectType::JOB.into_raw() },
1814                    2147483648,
1815                >,
1816                fidl::encoding::DefaultFuchsiaResourceDialect,
1817            >,
1818            T2: fidl::encoding::Encode<
1819                fidl::encoding::BoundedString<32>,
1820                fidl::encoding::DefaultFuchsiaResourceDialect,
1821            >,
1822        > fidl::encoding::Encode<LaunchInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
1823        for (T0, T1, T2)
1824    {
1825        #[inline]
1826        unsafe fn encode(
1827            self,
1828            encoder: &mut fidl::encoding::Encoder<
1829                '_,
1830                fidl::encoding::DefaultFuchsiaResourceDialect,
1831            >,
1832            offset: usize,
1833            depth: fidl::encoding::Depth,
1834        ) -> fidl::Result<()> {
1835            encoder.debug_check_bounds::<LaunchInfo>(offset);
1836            // Zero out padding regions. There's no need to apply masks
1837            // because the unmasked parts will be overwritten by fields.
1838            // Write the fields.
1839            self.0.encode(encoder, offset + 0, depth)?;
1840            self.1.encode(encoder, offset + 4, depth)?;
1841            self.2.encode(encoder, offset + 8, depth)?;
1842            Ok(())
1843        }
1844    }
1845
1846    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for LaunchInfo {
1847        #[inline(always)]
1848        fn new_empty() -> Self {
1849            Self {
1850                executable: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1851                job: fidl::new_empty!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1852                name: fidl::new_empty!(
1853                    fidl::encoding::BoundedString<32>,
1854                    fidl::encoding::DefaultFuchsiaResourceDialect
1855                ),
1856            }
1857        }
1858
1859        #[inline]
1860        unsafe fn decode(
1861            &mut self,
1862            decoder: &mut fidl::encoding::Decoder<
1863                '_,
1864                fidl::encoding::DefaultFuchsiaResourceDialect,
1865            >,
1866            offset: usize,
1867            _depth: fidl::encoding::Depth,
1868        ) -> fidl::Result<()> {
1869            decoder.debug_check_bounds::<Self>(offset);
1870            // Verify that padding bytes are zero.
1871            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.executable, decoder, offset + 0, _depth)?;
1872            fidl::decode!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.job, decoder, offset + 4, _depth)?;
1873            fidl::decode!(
1874                fidl::encoding::BoundedString<32>,
1875                fidl::encoding::DefaultFuchsiaResourceDialect,
1876                &mut self.name,
1877                decoder,
1878                offset + 8,
1879                _depth
1880            )?;
1881            Ok(())
1882        }
1883    }
1884
1885    impl fidl::encoding::ValueTypeMarker for LauncherAddArgsRequest {
1886        type Borrowed<'a> = &'a Self;
1887        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1888            value
1889        }
1890    }
1891
1892    unsafe impl fidl::encoding::TypeMarker for LauncherAddArgsRequest {
1893        type Owned = Self;
1894
1895        #[inline(always)]
1896        fn inline_align(_context: fidl::encoding::Context) -> usize {
1897            8
1898        }
1899
1900        #[inline(always)]
1901        fn inline_size(_context: fidl::encoding::Context) -> usize {
1902            16
1903        }
1904    }
1905
1906    unsafe impl<D: fidl::encoding::ResourceDialect>
1907        fidl::encoding::Encode<LauncherAddArgsRequest, D> for &LauncherAddArgsRequest
1908    {
1909        #[inline]
1910        unsafe fn encode(
1911            self,
1912            encoder: &mut fidl::encoding::Encoder<'_, D>,
1913            offset: usize,
1914            _depth: fidl::encoding::Depth,
1915        ) -> fidl::Result<()> {
1916            encoder.debug_check_bounds::<LauncherAddArgsRequest>(offset);
1917            // Delegate to tuple encoding.
1918            fidl::encoding::Encode::<LauncherAddArgsRequest, D>::encode(
1919                (
1920                    <fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>> as fidl::encoding::ValueTypeMarker>::borrow(&self.args),
1921                ),
1922                encoder, offset, _depth
1923            )
1924        }
1925    }
1926    unsafe impl<
1927            D: fidl::encoding::ResourceDialect,
1928            T0: fidl::encoding::Encode<
1929                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>,
1930                D,
1931            >,
1932        > fidl::encoding::Encode<LauncherAddArgsRequest, D> for (T0,)
1933    {
1934        #[inline]
1935        unsafe fn encode(
1936            self,
1937            encoder: &mut fidl::encoding::Encoder<'_, D>,
1938            offset: usize,
1939            depth: fidl::encoding::Depth,
1940        ) -> fidl::Result<()> {
1941            encoder.debug_check_bounds::<LauncherAddArgsRequest>(offset);
1942            // Zero out padding regions. There's no need to apply masks
1943            // because the unmasked parts will be overwritten by fields.
1944            // Write the fields.
1945            self.0.encode(encoder, offset + 0, depth)?;
1946            Ok(())
1947        }
1948    }
1949
1950    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1951        for LauncherAddArgsRequest
1952    {
1953        #[inline(always)]
1954        fn new_empty() -> Self {
1955            Self {
1956                args: fidl::new_empty!(
1957                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>,
1958                    D
1959                ),
1960            }
1961        }
1962
1963        #[inline]
1964        unsafe fn decode(
1965            &mut self,
1966            decoder: &mut fidl::encoding::Decoder<'_, D>,
1967            offset: usize,
1968            _depth: fidl::encoding::Depth,
1969        ) -> fidl::Result<()> {
1970            decoder.debug_check_bounds::<Self>(offset);
1971            // Verify that padding bytes are zero.
1972            fidl::decode!(
1973                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>,
1974                D,
1975                &mut self.args,
1976                decoder,
1977                offset + 0,
1978                _depth
1979            )?;
1980            Ok(())
1981        }
1982    }
1983
1984    impl fidl::encoding::ValueTypeMarker for LauncherAddEnvironsRequest {
1985        type Borrowed<'a> = &'a Self;
1986        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1987            value
1988        }
1989    }
1990
1991    unsafe impl fidl::encoding::TypeMarker for LauncherAddEnvironsRequest {
1992        type Owned = Self;
1993
1994        #[inline(always)]
1995        fn inline_align(_context: fidl::encoding::Context) -> usize {
1996            8
1997        }
1998
1999        #[inline(always)]
2000        fn inline_size(_context: fidl::encoding::Context) -> usize {
2001            16
2002        }
2003    }
2004
2005    unsafe impl<D: fidl::encoding::ResourceDialect>
2006        fidl::encoding::Encode<LauncherAddEnvironsRequest, D> for &LauncherAddEnvironsRequest
2007    {
2008        #[inline]
2009        unsafe fn encode(
2010            self,
2011            encoder: &mut fidl::encoding::Encoder<'_, D>,
2012            offset: usize,
2013            _depth: fidl::encoding::Depth,
2014        ) -> fidl::Result<()> {
2015            encoder.debug_check_bounds::<LauncherAddEnvironsRequest>(offset);
2016            // Delegate to tuple encoding.
2017            fidl::encoding::Encode::<LauncherAddEnvironsRequest, D>::encode(
2018                (
2019                    <fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>> as fidl::encoding::ValueTypeMarker>::borrow(&self.environ),
2020                ),
2021                encoder, offset, _depth
2022            )
2023        }
2024    }
2025    unsafe impl<
2026            D: fidl::encoding::ResourceDialect,
2027            T0: fidl::encoding::Encode<
2028                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>,
2029                D,
2030            >,
2031        > fidl::encoding::Encode<LauncherAddEnvironsRequest, D> for (T0,)
2032    {
2033        #[inline]
2034        unsafe fn encode(
2035            self,
2036            encoder: &mut fidl::encoding::Encoder<'_, D>,
2037            offset: usize,
2038            depth: fidl::encoding::Depth,
2039        ) -> fidl::Result<()> {
2040            encoder.debug_check_bounds::<LauncherAddEnvironsRequest>(offset);
2041            // Zero out padding regions. There's no need to apply masks
2042            // because the unmasked parts will be overwritten by fields.
2043            // Write the fields.
2044            self.0.encode(encoder, offset + 0, depth)?;
2045            Ok(())
2046        }
2047    }
2048
2049    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2050        for LauncherAddEnvironsRequest
2051    {
2052        #[inline(always)]
2053        fn new_empty() -> Self {
2054            Self {
2055                environ: fidl::new_empty!(
2056                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>,
2057                    D
2058                ),
2059            }
2060        }
2061
2062        #[inline]
2063        unsafe fn decode(
2064            &mut self,
2065            decoder: &mut fidl::encoding::Decoder<'_, D>,
2066            offset: usize,
2067            _depth: fidl::encoding::Depth,
2068        ) -> fidl::Result<()> {
2069            decoder.debug_check_bounds::<Self>(offset);
2070            // Verify that padding bytes are zero.
2071            fidl::decode!(
2072                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>,
2073                D,
2074                &mut self.environ,
2075                decoder,
2076                offset + 0,
2077                _depth
2078            )?;
2079            Ok(())
2080        }
2081    }
2082
2083    impl fidl::encoding::ResourceTypeMarker for LauncherAddHandlesRequest {
2084        type Borrowed<'a> = &'a mut Self;
2085        fn take_or_borrow<'a>(
2086            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2087        ) -> Self::Borrowed<'a> {
2088            value
2089        }
2090    }
2091
2092    unsafe impl fidl::encoding::TypeMarker for LauncherAddHandlesRequest {
2093        type Owned = Self;
2094
2095        #[inline(always)]
2096        fn inline_align(_context: fidl::encoding::Context) -> usize {
2097            8
2098        }
2099
2100        #[inline(always)]
2101        fn inline_size(_context: fidl::encoding::Context) -> usize {
2102            16
2103        }
2104    }
2105
2106    unsafe impl
2107        fidl::encoding::Encode<
2108            LauncherAddHandlesRequest,
2109            fidl::encoding::DefaultFuchsiaResourceDialect,
2110        > for &mut LauncherAddHandlesRequest
2111    {
2112        #[inline]
2113        unsafe fn encode(
2114            self,
2115            encoder: &mut fidl::encoding::Encoder<
2116                '_,
2117                fidl::encoding::DefaultFuchsiaResourceDialect,
2118            >,
2119            offset: usize,
2120            _depth: fidl::encoding::Depth,
2121        ) -> fidl::Result<()> {
2122            encoder.debug_check_bounds::<LauncherAddHandlesRequest>(offset);
2123            // Delegate to tuple encoding.
2124            fidl::encoding::Encode::<LauncherAddHandlesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2125                (
2126                    <fidl::encoding::UnboundedVector<HandleInfo> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handles),
2127                ),
2128                encoder, offset, _depth
2129            )
2130        }
2131    }
2132    unsafe impl<
2133            T0: fidl::encoding::Encode<
2134                fidl::encoding::UnboundedVector<HandleInfo>,
2135                fidl::encoding::DefaultFuchsiaResourceDialect,
2136            >,
2137        >
2138        fidl::encoding::Encode<
2139            LauncherAddHandlesRequest,
2140            fidl::encoding::DefaultFuchsiaResourceDialect,
2141        > for (T0,)
2142    {
2143        #[inline]
2144        unsafe fn encode(
2145            self,
2146            encoder: &mut fidl::encoding::Encoder<
2147                '_,
2148                fidl::encoding::DefaultFuchsiaResourceDialect,
2149            >,
2150            offset: usize,
2151            depth: fidl::encoding::Depth,
2152        ) -> fidl::Result<()> {
2153            encoder.debug_check_bounds::<LauncherAddHandlesRequest>(offset);
2154            // Zero out padding regions. There's no need to apply masks
2155            // because the unmasked parts will be overwritten by fields.
2156            // Write the fields.
2157            self.0.encode(encoder, offset + 0, depth)?;
2158            Ok(())
2159        }
2160    }
2161
2162    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2163        for LauncherAddHandlesRequest
2164    {
2165        #[inline(always)]
2166        fn new_empty() -> Self {
2167            Self {
2168                handles: fidl::new_empty!(
2169                    fidl::encoding::UnboundedVector<HandleInfo>,
2170                    fidl::encoding::DefaultFuchsiaResourceDialect
2171                ),
2172            }
2173        }
2174
2175        #[inline]
2176        unsafe fn decode(
2177            &mut self,
2178            decoder: &mut fidl::encoding::Decoder<
2179                '_,
2180                fidl::encoding::DefaultFuchsiaResourceDialect,
2181            >,
2182            offset: usize,
2183            _depth: fidl::encoding::Depth,
2184        ) -> fidl::Result<()> {
2185            decoder.debug_check_bounds::<Self>(offset);
2186            // Verify that padding bytes are zero.
2187            fidl::decode!(
2188                fidl::encoding::UnboundedVector<HandleInfo>,
2189                fidl::encoding::DefaultFuchsiaResourceDialect,
2190                &mut self.handles,
2191                decoder,
2192                offset + 0,
2193                _depth
2194            )?;
2195            Ok(())
2196        }
2197    }
2198
2199    impl fidl::encoding::ResourceTypeMarker for LauncherAddNamesRequest {
2200        type Borrowed<'a> = &'a mut Self;
2201        fn take_or_borrow<'a>(
2202            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2203        ) -> Self::Borrowed<'a> {
2204            value
2205        }
2206    }
2207
2208    unsafe impl fidl::encoding::TypeMarker for LauncherAddNamesRequest {
2209        type Owned = Self;
2210
2211        #[inline(always)]
2212        fn inline_align(_context: fidl::encoding::Context) -> usize {
2213            8
2214        }
2215
2216        #[inline(always)]
2217        fn inline_size(_context: fidl::encoding::Context) -> usize {
2218            16
2219        }
2220    }
2221
2222    unsafe impl
2223        fidl::encoding::Encode<
2224            LauncherAddNamesRequest,
2225            fidl::encoding::DefaultFuchsiaResourceDialect,
2226        > for &mut LauncherAddNamesRequest
2227    {
2228        #[inline]
2229        unsafe fn encode(
2230            self,
2231            encoder: &mut fidl::encoding::Encoder<
2232                '_,
2233                fidl::encoding::DefaultFuchsiaResourceDialect,
2234            >,
2235            offset: usize,
2236            _depth: fidl::encoding::Depth,
2237        ) -> fidl::Result<()> {
2238            encoder.debug_check_bounds::<LauncherAddNamesRequest>(offset);
2239            // Delegate to tuple encoding.
2240            fidl::encoding::Encode::<LauncherAddNamesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2241                (
2242                    <fidl::encoding::UnboundedVector<NameInfo> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.names),
2243                ),
2244                encoder, offset, _depth
2245            )
2246        }
2247    }
2248    unsafe impl<
2249            T0: fidl::encoding::Encode<
2250                fidl::encoding::UnboundedVector<NameInfo>,
2251                fidl::encoding::DefaultFuchsiaResourceDialect,
2252            >,
2253        >
2254        fidl::encoding::Encode<
2255            LauncherAddNamesRequest,
2256            fidl::encoding::DefaultFuchsiaResourceDialect,
2257        > for (T0,)
2258    {
2259        #[inline]
2260        unsafe fn encode(
2261            self,
2262            encoder: &mut fidl::encoding::Encoder<
2263                '_,
2264                fidl::encoding::DefaultFuchsiaResourceDialect,
2265            >,
2266            offset: usize,
2267            depth: fidl::encoding::Depth,
2268        ) -> fidl::Result<()> {
2269            encoder.debug_check_bounds::<LauncherAddNamesRequest>(offset);
2270            // Zero out padding regions. There's no need to apply masks
2271            // because the unmasked parts will be overwritten by fields.
2272            // Write the fields.
2273            self.0.encode(encoder, offset + 0, depth)?;
2274            Ok(())
2275        }
2276    }
2277
2278    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2279        for LauncherAddNamesRequest
2280    {
2281        #[inline(always)]
2282        fn new_empty() -> Self {
2283            Self {
2284                names: fidl::new_empty!(
2285                    fidl::encoding::UnboundedVector<NameInfo>,
2286                    fidl::encoding::DefaultFuchsiaResourceDialect
2287                ),
2288            }
2289        }
2290
2291        #[inline]
2292        unsafe fn decode(
2293            &mut self,
2294            decoder: &mut fidl::encoding::Decoder<
2295                '_,
2296                fidl::encoding::DefaultFuchsiaResourceDialect,
2297            >,
2298            offset: usize,
2299            _depth: fidl::encoding::Depth,
2300        ) -> fidl::Result<()> {
2301            decoder.debug_check_bounds::<Self>(offset);
2302            // Verify that padding bytes are zero.
2303            fidl::decode!(
2304                fidl::encoding::UnboundedVector<NameInfo>,
2305                fidl::encoding::DefaultFuchsiaResourceDialect,
2306                &mut self.names,
2307                decoder,
2308                offset + 0,
2309                _depth
2310            )?;
2311            Ok(())
2312        }
2313    }
2314
2315    impl fidl::encoding::ResourceTypeMarker for LauncherCreateWithoutStartingRequest {
2316        type Borrowed<'a> = &'a mut Self;
2317        fn take_or_borrow<'a>(
2318            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2319        ) -> Self::Borrowed<'a> {
2320            value
2321        }
2322    }
2323
2324    unsafe impl fidl::encoding::TypeMarker for LauncherCreateWithoutStartingRequest {
2325        type Owned = Self;
2326
2327        #[inline(always)]
2328        fn inline_align(_context: fidl::encoding::Context) -> usize {
2329            8
2330        }
2331
2332        #[inline(always)]
2333        fn inline_size(_context: fidl::encoding::Context) -> usize {
2334            24
2335        }
2336    }
2337
2338    unsafe impl
2339        fidl::encoding::Encode<
2340            LauncherCreateWithoutStartingRequest,
2341            fidl::encoding::DefaultFuchsiaResourceDialect,
2342        > for &mut LauncherCreateWithoutStartingRequest
2343    {
2344        #[inline]
2345        unsafe fn encode(
2346            self,
2347            encoder: &mut fidl::encoding::Encoder<
2348                '_,
2349                fidl::encoding::DefaultFuchsiaResourceDialect,
2350            >,
2351            offset: usize,
2352            _depth: fidl::encoding::Depth,
2353        ) -> fidl::Result<()> {
2354            encoder.debug_check_bounds::<LauncherCreateWithoutStartingRequest>(offset);
2355            // Delegate to tuple encoding.
2356            fidl::encoding::Encode::<
2357                LauncherCreateWithoutStartingRequest,
2358                fidl::encoding::DefaultFuchsiaResourceDialect,
2359            >::encode(
2360                (<LaunchInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2361                    &mut self.info,
2362                ),),
2363                encoder,
2364                offset,
2365                _depth,
2366            )
2367        }
2368    }
2369    unsafe impl<T0: fidl::encoding::Encode<LaunchInfo, fidl::encoding::DefaultFuchsiaResourceDialect>>
2370        fidl::encoding::Encode<
2371            LauncherCreateWithoutStartingRequest,
2372            fidl::encoding::DefaultFuchsiaResourceDialect,
2373        > for (T0,)
2374    {
2375        #[inline]
2376        unsafe fn encode(
2377            self,
2378            encoder: &mut fidl::encoding::Encoder<
2379                '_,
2380                fidl::encoding::DefaultFuchsiaResourceDialect,
2381            >,
2382            offset: usize,
2383            depth: fidl::encoding::Depth,
2384        ) -> fidl::Result<()> {
2385            encoder.debug_check_bounds::<LauncherCreateWithoutStartingRequest>(offset);
2386            // Zero out padding regions. There's no need to apply masks
2387            // because the unmasked parts will be overwritten by fields.
2388            // Write the fields.
2389            self.0.encode(encoder, offset + 0, depth)?;
2390            Ok(())
2391        }
2392    }
2393
2394    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2395        for LauncherCreateWithoutStartingRequest
2396    {
2397        #[inline(always)]
2398        fn new_empty() -> Self {
2399            Self {
2400                info: fidl::new_empty!(LaunchInfo, fidl::encoding::DefaultFuchsiaResourceDialect),
2401            }
2402        }
2403
2404        #[inline]
2405        unsafe fn decode(
2406            &mut self,
2407            decoder: &mut fidl::encoding::Decoder<
2408                '_,
2409                fidl::encoding::DefaultFuchsiaResourceDialect,
2410            >,
2411            offset: usize,
2412            _depth: fidl::encoding::Depth,
2413        ) -> fidl::Result<()> {
2414            decoder.debug_check_bounds::<Self>(offset);
2415            // Verify that padding bytes are zero.
2416            fidl::decode!(
2417                LaunchInfo,
2418                fidl::encoding::DefaultFuchsiaResourceDialect,
2419                &mut self.info,
2420                decoder,
2421                offset + 0,
2422                _depth
2423            )?;
2424            Ok(())
2425        }
2426    }
2427
2428    impl fidl::encoding::ResourceTypeMarker for LauncherCreateWithoutStartingResponse {
2429        type Borrowed<'a> = &'a mut Self;
2430        fn take_or_borrow<'a>(
2431            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2432        ) -> Self::Borrowed<'a> {
2433            value
2434        }
2435    }
2436
2437    unsafe impl fidl::encoding::TypeMarker for LauncherCreateWithoutStartingResponse {
2438        type Owned = Self;
2439
2440        #[inline(always)]
2441        fn inline_align(_context: fidl::encoding::Context) -> usize {
2442            8
2443        }
2444
2445        #[inline(always)]
2446        fn inline_size(_context: fidl::encoding::Context) -> usize {
2447            16
2448        }
2449    }
2450
2451    unsafe impl
2452        fidl::encoding::Encode<
2453            LauncherCreateWithoutStartingResponse,
2454            fidl::encoding::DefaultFuchsiaResourceDialect,
2455        > for &mut LauncherCreateWithoutStartingResponse
2456    {
2457        #[inline]
2458        unsafe fn encode(
2459            self,
2460            encoder: &mut fidl::encoding::Encoder<
2461                '_,
2462                fidl::encoding::DefaultFuchsiaResourceDialect,
2463            >,
2464            offset: usize,
2465            _depth: fidl::encoding::Depth,
2466        ) -> fidl::Result<()> {
2467            encoder.debug_check_bounds::<LauncherCreateWithoutStartingResponse>(offset);
2468            // Delegate to tuple encoding.
2469            fidl::encoding::Encode::<LauncherCreateWithoutStartingResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2470                (
2471                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2472                    <fidl::encoding::Boxed<ProcessStartData> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.data),
2473                ),
2474                encoder, offset, _depth
2475            )
2476        }
2477    }
2478    unsafe impl<
2479            T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2480            T1: fidl::encoding::Encode<
2481                fidl::encoding::Boxed<ProcessStartData>,
2482                fidl::encoding::DefaultFuchsiaResourceDialect,
2483            >,
2484        >
2485        fidl::encoding::Encode<
2486            LauncherCreateWithoutStartingResponse,
2487            fidl::encoding::DefaultFuchsiaResourceDialect,
2488        > for (T0, T1)
2489    {
2490        #[inline]
2491        unsafe fn encode(
2492            self,
2493            encoder: &mut fidl::encoding::Encoder<
2494                '_,
2495                fidl::encoding::DefaultFuchsiaResourceDialect,
2496            >,
2497            offset: usize,
2498            depth: fidl::encoding::Depth,
2499        ) -> fidl::Result<()> {
2500            encoder.debug_check_bounds::<LauncherCreateWithoutStartingResponse>(offset);
2501            // Zero out padding regions. There's no need to apply masks
2502            // because the unmasked parts will be overwritten by fields.
2503            unsafe {
2504                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2505                (ptr as *mut u64).write_unaligned(0);
2506            }
2507            // Write the fields.
2508            self.0.encode(encoder, offset + 0, depth)?;
2509            self.1.encode(encoder, offset + 8, depth)?;
2510            Ok(())
2511        }
2512    }
2513
2514    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2515        for LauncherCreateWithoutStartingResponse
2516    {
2517        #[inline(always)]
2518        fn new_empty() -> Self {
2519            Self {
2520                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
2521                data: fidl::new_empty!(
2522                    fidl::encoding::Boxed<ProcessStartData>,
2523                    fidl::encoding::DefaultFuchsiaResourceDialect
2524                ),
2525            }
2526        }
2527
2528        #[inline]
2529        unsafe fn decode(
2530            &mut self,
2531            decoder: &mut fidl::encoding::Decoder<
2532                '_,
2533                fidl::encoding::DefaultFuchsiaResourceDialect,
2534            >,
2535            offset: usize,
2536            _depth: fidl::encoding::Depth,
2537        ) -> fidl::Result<()> {
2538            decoder.debug_check_bounds::<Self>(offset);
2539            // Verify that padding bytes are zero.
2540            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2541            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2542            let mask = 0xffffffff00000000u64;
2543            let maskedval = padval & mask;
2544            if maskedval != 0 {
2545                return Err(fidl::Error::NonZeroPadding {
2546                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2547                });
2548            }
2549            fidl::decode!(
2550                i32,
2551                fidl::encoding::DefaultFuchsiaResourceDialect,
2552                &mut self.status,
2553                decoder,
2554                offset + 0,
2555                _depth
2556            )?;
2557            fidl::decode!(
2558                fidl::encoding::Boxed<ProcessStartData>,
2559                fidl::encoding::DefaultFuchsiaResourceDialect,
2560                &mut self.data,
2561                decoder,
2562                offset + 8,
2563                _depth
2564            )?;
2565            Ok(())
2566        }
2567    }
2568
2569    impl fidl::encoding::ResourceTypeMarker for LauncherLaunchRequest {
2570        type Borrowed<'a> = &'a mut Self;
2571        fn take_or_borrow<'a>(
2572            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2573        ) -> Self::Borrowed<'a> {
2574            value
2575        }
2576    }
2577
2578    unsafe impl fidl::encoding::TypeMarker for LauncherLaunchRequest {
2579        type Owned = Self;
2580
2581        #[inline(always)]
2582        fn inline_align(_context: fidl::encoding::Context) -> usize {
2583            8
2584        }
2585
2586        #[inline(always)]
2587        fn inline_size(_context: fidl::encoding::Context) -> usize {
2588            24
2589        }
2590    }
2591
2592    unsafe impl
2593        fidl::encoding::Encode<LauncherLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2594        for &mut LauncherLaunchRequest
2595    {
2596        #[inline]
2597        unsafe fn encode(
2598            self,
2599            encoder: &mut fidl::encoding::Encoder<
2600                '_,
2601                fidl::encoding::DefaultFuchsiaResourceDialect,
2602            >,
2603            offset: usize,
2604            _depth: fidl::encoding::Depth,
2605        ) -> fidl::Result<()> {
2606            encoder.debug_check_bounds::<LauncherLaunchRequest>(offset);
2607            // Delegate to tuple encoding.
2608            fidl::encoding::Encode::<
2609                LauncherLaunchRequest,
2610                fidl::encoding::DefaultFuchsiaResourceDialect,
2611            >::encode(
2612                (<LaunchInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2613                    &mut self.info,
2614                ),),
2615                encoder,
2616                offset,
2617                _depth,
2618            )
2619        }
2620    }
2621    unsafe impl<T0: fidl::encoding::Encode<LaunchInfo, fidl::encoding::DefaultFuchsiaResourceDialect>>
2622        fidl::encoding::Encode<LauncherLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2623        for (T0,)
2624    {
2625        #[inline]
2626        unsafe fn encode(
2627            self,
2628            encoder: &mut fidl::encoding::Encoder<
2629                '_,
2630                fidl::encoding::DefaultFuchsiaResourceDialect,
2631            >,
2632            offset: usize,
2633            depth: fidl::encoding::Depth,
2634        ) -> fidl::Result<()> {
2635            encoder.debug_check_bounds::<LauncherLaunchRequest>(offset);
2636            // Zero out padding regions. There's no need to apply masks
2637            // because the unmasked parts will be overwritten by fields.
2638            // Write the fields.
2639            self.0.encode(encoder, offset + 0, depth)?;
2640            Ok(())
2641        }
2642    }
2643
2644    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2645        for LauncherLaunchRequest
2646    {
2647        #[inline(always)]
2648        fn new_empty() -> Self {
2649            Self {
2650                info: fidl::new_empty!(LaunchInfo, fidl::encoding::DefaultFuchsiaResourceDialect),
2651            }
2652        }
2653
2654        #[inline]
2655        unsafe fn decode(
2656            &mut self,
2657            decoder: &mut fidl::encoding::Decoder<
2658                '_,
2659                fidl::encoding::DefaultFuchsiaResourceDialect,
2660            >,
2661            offset: usize,
2662            _depth: fidl::encoding::Depth,
2663        ) -> fidl::Result<()> {
2664            decoder.debug_check_bounds::<Self>(offset);
2665            // Verify that padding bytes are zero.
2666            fidl::decode!(
2667                LaunchInfo,
2668                fidl::encoding::DefaultFuchsiaResourceDialect,
2669                &mut self.info,
2670                decoder,
2671                offset + 0,
2672                _depth
2673            )?;
2674            Ok(())
2675        }
2676    }
2677
2678    impl fidl::encoding::ResourceTypeMarker for LauncherLaunchResponse {
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 LauncherLaunchResponse {
2688        type Owned = Self;
2689
2690        #[inline(always)]
2691        fn inline_align(_context: fidl::encoding::Context) -> usize {
2692            4
2693        }
2694
2695        #[inline(always)]
2696        fn inline_size(_context: fidl::encoding::Context) -> usize {
2697            8
2698        }
2699    }
2700
2701    unsafe impl
2702        fidl::encoding::Encode<
2703            LauncherLaunchResponse,
2704            fidl::encoding::DefaultFuchsiaResourceDialect,
2705        > for &mut LauncherLaunchResponse
2706    {
2707        #[inline]
2708        unsafe fn encode(
2709            self,
2710            encoder: &mut fidl::encoding::Encoder<
2711                '_,
2712                fidl::encoding::DefaultFuchsiaResourceDialect,
2713            >,
2714            offset: usize,
2715            _depth: fidl::encoding::Depth,
2716        ) -> fidl::Result<()> {
2717            encoder.debug_check_bounds::<LauncherLaunchResponse>(offset);
2718            // Delegate to tuple encoding.
2719            fidl::encoding::Encode::<
2720                LauncherLaunchResponse,
2721                fidl::encoding::DefaultFuchsiaResourceDialect,
2722            >::encode(
2723                (
2724                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2725                    <fidl::encoding::Optional<
2726                        fidl::encoding::HandleType<
2727                            fidl::Process,
2728                            { fidl::ObjectType::PROCESS.into_raw() },
2729                            2147483648,
2730                        >,
2731                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2732                        &mut self.process
2733                    ),
2734                ),
2735                encoder,
2736                offset,
2737                _depth,
2738            )
2739        }
2740    }
2741    unsafe impl<
2742            T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2743            T1: fidl::encoding::Encode<
2744                fidl::encoding::Optional<
2745                    fidl::encoding::HandleType<
2746                        fidl::Process,
2747                        { fidl::ObjectType::PROCESS.into_raw() },
2748                        2147483648,
2749                    >,
2750                >,
2751                fidl::encoding::DefaultFuchsiaResourceDialect,
2752            >,
2753        >
2754        fidl::encoding::Encode<
2755            LauncherLaunchResponse,
2756            fidl::encoding::DefaultFuchsiaResourceDialect,
2757        > for (T0, T1)
2758    {
2759        #[inline]
2760        unsafe fn encode(
2761            self,
2762            encoder: &mut fidl::encoding::Encoder<
2763                '_,
2764                fidl::encoding::DefaultFuchsiaResourceDialect,
2765            >,
2766            offset: usize,
2767            depth: fidl::encoding::Depth,
2768        ) -> fidl::Result<()> {
2769            encoder.debug_check_bounds::<LauncherLaunchResponse>(offset);
2770            // Zero out padding regions. There's no need to apply masks
2771            // because the unmasked parts will be overwritten by fields.
2772            // Write the fields.
2773            self.0.encode(encoder, offset + 0, depth)?;
2774            self.1.encode(encoder, offset + 4, depth)?;
2775            Ok(())
2776        }
2777    }
2778
2779    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2780        for LauncherLaunchResponse
2781    {
2782        #[inline(always)]
2783        fn new_empty() -> Self {
2784            Self {
2785                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
2786                process: fidl::new_empty!(
2787                    fidl::encoding::Optional<
2788                        fidl::encoding::HandleType<
2789                            fidl::Process,
2790                            { fidl::ObjectType::PROCESS.into_raw() },
2791                            2147483648,
2792                        >,
2793                    >,
2794                    fidl::encoding::DefaultFuchsiaResourceDialect
2795                ),
2796            }
2797        }
2798
2799        #[inline]
2800        unsafe fn decode(
2801            &mut self,
2802            decoder: &mut fidl::encoding::Decoder<
2803                '_,
2804                fidl::encoding::DefaultFuchsiaResourceDialect,
2805            >,
2806            offset: usize,
2807            _depth: fidl::encoding::Depth,
2808        ) -> fidl::Result<()> {
2809            decoder.debug_check_bounds::<Self>(offset);
2810            // Verify that padding bytes are zero.
2811            fidl::decode!(
2812                i32,
2813                fidl::encoding::DefaultFuchsiaResourceDialect,
2814                &mut self.status,
2815                decoder,
2816                offset + 0,
2817                _depth
2818            )?;
2819            fidl::decode!(
2820                fidl::encoding::Optional<
2821                    fidl::encoding::HandleType<
2822                        fidl::Process,
2823                        { fidl::ObjectType::PROCESS.into_raw() },
2824                        2147483648,
2825                    >,
2826                >,
2827                fidl::encoding::DefaultFuchsiaResourceDialect,
2828                &mut self.process,
2829                decoder,
2830                offset + 4,
2831                _depth
2832            )?;
2833            Ok(())
2834        }
2835    }
2836
2837    impl fidl::encoding::ValueTypeMarker for LauncherSetOptionsRequest {
2838        type Borrowed<'a> = &'a Self;
2839        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2840            value
2841        }
2842    }
2843
2844    unsafe impl fidl::encoding::TypeMarker for LauncherSetOptionsRequest {
2845        type Owned = Self;
2846
2847        #[inline(always)]
2848        fn inline_align(_context: fidl::encoding::Context) -> usize {
2849            4
2850        }
2851
2852        #[inline(always)]
2853        fn inline_size(_context: fidl::encoding::Context) -> usize {
2854            4
2855        }
2856        #[inline(always)]
2857        fn encode_is_copy() -> bool {
2858            true
2859        }
2860
2861        #[inline(always)]
2862        fn decode_is_copy() -> bool {
2863            true
2864        }
2865    }
2866
2867    unsafe impl<D: fidl::encoding::ResourceDialect>
2868        fidl::encoding::Encode<LauncherSetOptionsRequest, D> for &LauncherSetOptionsRequest
2869    {
2870        #[inline]
2871        unsafe fn encode(
2872            self,
2873            encoder: &mut fidl::encoding::Encoder<'_, D>,
2874            offset: usize,
2875            _depth: fidl::encoding::Depth,
2876        ) -> fidl::Result<()> {
2877            encoder.debug_check_bounds::<LauncherSetOptionsRequest>(offset);
2878            unsafe {
2879                // Copy the object into the buffer.
2880                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2881                (buf_ptr as *mut LauncherSetOptionsRequest)
2882                    .write_unaligned((self as *const LauncherSetOptionsRequest).read());
2883                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2884                // done second because the memcpy will write garbage to these bytes.
2885            }
2886            Ok(())
2887        }
2888    }
2889    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
2890        fidl::encoding::Encode<LauncherSetOptionsRequest, D> for (T0,)
2891    {
2892        #[inline]
2893        unsafe fn encode(
2894            self,
2895            encoder: &mut fidl::encoding::Encoder<'_, D>,
2896            offset: usize,
2897            depth: fidl::encoding::Depth,
2898        ) -> fidl::Result<()> {
2899            encoder.debug_check_bounds::<LauncherSetOptionsRequest>(offset);
2900            // Zero out padding regions. There's no need to apply masks
2901            // because the unmasked parts will be overwritten by fields.
2902            // Write the fields.
2903            self.0.encode(encoder, offset + 0, depth)?;
2904            Ok(())
2905        }
2906    }
2907
2908    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2909        for LauncherSetOptionsRequest
2910    {
2911        #[inline(always)]
2912        fn new_empty() -> Self {
2913            Self { options: fidl::new_empty!(u32, D) }
2914        }
2915
2916        #[inline]
2917        unsafe fn decode(
2918            &mut self,
2919            decoder: &mut fidl::encoding::Decoder<'_, D>,
2920            offset: usize,
2921            _depth: fidl::encoding::Depth,
2922        ) -> fidl::Result<()> {
2923            decoder.debug_check_bounds::<Self>(offset);
2924            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2925            // Verify that padding bytes are zero.
2926            // Copy from the buffer into the object.
2927            unsafe {
2928                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2929            }
2930            Ok(())
2931        }
2932    }
2933
2934    impl fidl::encoding::ResourceTypeMarker for NameInfo {
2935        type Borrowed<'a> = &'a mut Self;
2936        fn take_or_borrow<'a>(
2937            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2938        ) -> Self::Borrowed<'a> {
2939            value
2940        }
2941    }
2942
2943    unsafe impl fidl::encoding::TypeMarker for NameInfo {
2944        type Owned = Self;
2945
2946        #[inline(always)]
2947        fn inline_align(_context: fidl::encoding::Context) -> usize {
2948            8
2949        }
2950
2951        #[inline(always)]
2952        fn inline_size(_context: fidl::encoding::Context) -> usize {
2953            24
2954        }
2955    }
2956
2957    unsafe impl fidl::encoding::Encode<NameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
2958        for &mut NameInfo
2959    {
2960        #[inline]
2961        unsafe fn encode(
2962            self,
2963            encoder: &mut fidl::encoding::Encoder<
2964                '_,
2965                fidl::encoding::DefaultFuchsiaResourceDialect,
2966            >,
2967            offset: usize,
2968            _depth: fidl::encoding::Depth,
2969        ) -> fidl::Result<()> {
2970            encoder.debug_check_bounds::<NameInfo>(offset);
2971            // Delegate to tuple encoding.
2972            fidl::encoding::Encode::<NameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2973                (
2974                    <fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow(&self.path),
2975                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.directory),
2976                ),
2977                encoder, offset, _depth
2978            )
2979        }
2980    }
2981    unsafe impl<
2982            T0: fidl::encoding::Encode<
2983                fidl::encoding::BoundedString<4095>,
2984                fidl::encoding::DefaultFuchsiaResourceDialect,
2985            >,
2986            T1: fidl::encoding::Encode<
2987                fidl::encoding::Endpoint<
2988                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2989                >,
2990                fidl::encoding::DefaultFuchsiaResourceDialect,
2991            >,
2992        > fidl::encoding::Encode<NameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
2993        for (T0, T1)
2994    {
2995        #[inline]
2996        unsafe fn encode(
2997            self,
2998            encoder: &mut fidl::encoding::Encoder<
2999                '_,
3000                fidl::encoding::DefaultFuchsiaResourceDialect,
3001            >,
3002            offset: usize,
3003            depth: fidl::encoding::Depth,
3004        ) -> fidl::Result<()> {
3005            encoder.debug_check_bounds::<NameInfo>(offset);
3006            // Zero out padding regions. There's no need to apply masks
3007            // because the unmasked parts will be overwritten by fields.
3008            unsafe {
3009                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3010                (ptr as *mut u64).write_unaligned(0);
3011            }
3012            // Write the fields.
3013            self.0.encode(encoder, offset + 0, depth)?;
3014            self.1.encode(encoder, offset + 16, depth)?;
3015            Ok(())
3016        }
3017    }
3018
3019    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for NameInfo {
3020        #[inline(always)]
3021        fn new_empty() -> Self {
3022            Self {
3023                path: fidl::new_empty!(
3024                    fidl::encoding::BoundedString<4095>,
3025                    fidl::encoding::DefaultFuchsiaResourceDialect
3026                ),
3027                directory: fidl::new_empty!(
3028                    fidl::encoding::Endpoint<
3029                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3030                    >,
3031                    fidl::encoding::DefaultFuchsiaResourceDialect
3032                ),
3033            }
3034        }
3035
3036        #[inline]
3037        unsafe fn decode(
3038            &mut self,
3039            decoder: &mut fidl::encoding::Decoder<
3040                '_,
3041                fidl::encoding::DefaultFuchsiaResourceDialect,
3042            >,
3043            offset: usize,
3044            _depth: fidl::encoding::Depth,
3045        ) -> fidl::Result<()> {
3046            decoder.debug_check_bounds::<Self>(offset);
3047            // Verify that padding bytes are zero.
3048            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3049            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3050            let mask = 0xffffffff00000000u64;
3051            let maskedval = padval & mask;
3052            if maskedval != 0 {
3053                return Err(fidl::Error::NonZeroPadding {
3054                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3055                });
3056            }
3057            fidl::decode!(
3058                fidl::encoding::BoundedString<4095>,
3059                fidl::encoding::DefaultFuchsiaResourceDialect,
3060                &mut self.path,
3061                decoder,
3062                offset + 0,
3063                _depth
3064            )?;
3065            fidl::decode!(
3066                fidl::encoding::Endpoint<
3067                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3068                >,
3069                fidl::encoding::DefaultFuchsiaResourceDialect,
3070                &mut self.directory,
3071                decoder,
3072                offset + 16,
3073                _depth
3074            )?;
3075            Ok(())
3076        }
3077    }
3078
3079    impl fidl::encoding::ResourceTypeMarker for ProcessStartData {
3080        type Borrowed<'a> = &'a mut Self;
3081        fn take_or_borrow<'a>(
3082            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3083        ) -> Self::Borrowed<'a> {
3084            value
3085        }
3086    }
3087
3088    unsafe impl fidl::encoding::TypeMarker for ProcessStartData {
3089        type Owned = Self;
3090
3091        #[inline(always)]
3092        fn inline_align(_context: fidl::encoding::Context) -> usize {
3093            8
3094        }
3095
3096        #[inline(always)]
3097        fn inline_size(_context: fidl::encoding::Context) -> usize {
3098            56
3099        }
3100    }
3101
3102    unsafe impl
3103        fidl::encoding::Encode<ProcessStartData, fidl::encoding::DefaultFuchsiaResourceDialect>
3104        for &mut ProcessStartData
3105    {
3106        #[inline]
3107        unsafe fn encode(
3108            self,
3109            encoder: &mut fidl::encoding::Encoder<
3110                '_,
3111                fidl::encoding::DefaultFuchsiaResourceDialect,
3112            >,
3113            offset: usize,
3114            _depth: fidl::encoding::Depth,
3115        ) -> fidl::Result<()> {
3116            encoder.debug_check_bounds::<ProcessStartData>(offset);
3117            // Delegate to tuple encoding.
3118            fidl::encoding::Encode::<ProcessStartData, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3119                (
3120                    <fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.process),
3121                    <fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.root_vmar),
3122                    <fidl::encoding::HandleType<fidl::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.thread),
3123                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.entry),
3124                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.stack),
3125                    <fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.bootstrap),
3126                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.vdso_base),
3127                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.base),
3128                ),
3129                encoder, offset, _depth
3130            )
3131        }
3132    }
3133    unsafe impl<
3134            T0: fidl::encoding::Encode<
3135                fidl::encoding::HandleType<
3136                    fidl::Process,
3137                    { fidl::ObjectType::PROCESS.into_raw() },
3138                    2147483648,
3139                >,
3140                fidl::encoding::DefaultFuchsiaResourceDialect,
3141            >,
3142            T1: fidl::encoding::Encode<
3143                fidl::encoding::HandleType<
3144                    fidl::Vmar,
3145                    { fidl::ObjectType::VMAR.into_raw() },
3146                    2147483648,
3147                >,
3148                fidl::encoding::DefaultFuchsiaResourceDialect,
3149            >,
3150            T2: fidl::encoding::Encode<
3151                fidl::encoding::HandleType<
3152                    fidl::Thread,
3153                    { fidl::ObjectType::THREAD.into_raw() },
3154                    2147483648,
3155                >,
3156                fidl::encoding::DefaultFuchsiaResourceDialect,
3157            >,
3158            T3: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
3159            T4: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
3160            T5: fidl::encoding::Encode<
3161                fidl::encoding::HandleType<
3162                    fidl::Channel,
3163                    { fidl::ObjectType::CHANNEL.into_raw() },
3164                    2147483648,
3165                >,
3166                fidl::encoding::DefaultFuchsiaResourceDialect,
3167            >,
3168            T6: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
3169            T7: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
3170        >
3171        fidl::encoding::Encode<ProcessStartData, fidl::encoding::DefaultFuchsiaResourceDialect>
3172        for (T0, T1, T2, T3, T4, T5, T6, T7)
3173    {
3174        #[inline]
3175        unsafe fn encode(
3176            self,
3177            encoder: &mut fidl::encoding::Encoder<
3178                '_,
3179                fidl::encoding::DefaultFuchsiaResourceDialect,
3180            >,
3181            offset: usize,
3182            depth: fidl::encoding::Depth,
3183        ) -> fidl::Result<()> {
3184            encoder.debug_check_bounds::<ProcessStartData>(offset);
3185            // Zero out padding regions. There's no need to apply masks
3186            // because the unmasked parts will be overwritten by fields.
3187            unsafe {
3188                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3189                (ptr as *mut u64).write_unaligned(0);
3190            }
3191            unsafe {
3192                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
3193                (ptr as *mut u64).write_unaligned(0);
3194            }
3195            // Write the fields.
3196            self.0.encode(encoder, offset + 0, depth)?;
3197            self.1.encode(encoder, offset + 4, depth)?;
3198            self.2.encode(encoder, offset + 8, depth)?;
3199            self.3.encode(encoder, offset + 16, depth)?;
3200            self.4.encode(encoder, offset + 24, depth)?;
3201            self.5.encode(encoder, offset + 32, depth)?;
3202            self.6.encode(encoder, offset + 40, depth)?;
3203            self.7.encode(encoder, offset + 48, depth)?;
3204            Ok(())
3205        }
3206    }
3207
3208    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3209        for ProcessStartData
3210    {
3211        #[inline(always)]
3212        fn new_empty() -> Self {
3213            Self {
3214                process: fidl::new_empty!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3215                root_vmar: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3216                thread: fidl::new_empty!(fidl::encoding::HandleType<fidl::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3217                entry: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
3218                stack: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
3219                bootstrap: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3220                vdso_base: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
3221                base: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
3222            }
3223        }
3224
3225        #[inline]
3226        unsafe fn decode(
3227            &mut self,
3228            decoder: &mut fidl::encoding::Decoder<
3229                '_,
3230                fidl::encoding::DefaultFuchsiaResourceDialect,
3231            >,
3232            offset: usize,
3233            _depth: fidl::encoding::Depth,
3234        ) -> fidl::Result<()> {
3235            decoder.debug_check_bounds::<Self>(offset);
3236            // Verify that padding bytes are zero.
3237            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
3238            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3239            let mask = 0xffffffff00000000u64;
3240            let maskedval = padval & mask;
3241            if maskedval != 0 {
3242                return Err(fidl::Error::NonZeroPadding {
3243                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3244                });
3245            }
3246            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
3247            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3248            let mask = 0xffffffff00000000u64;
3249            let maskedval = padval & mask;
3250            if maskedval != 0 {
3251                return Err(fidl::Error::NonZeroPadding {
3252                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
3253                });
3254            }
3255            fidl::decode!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.process, decoder, offset + 0, _depth)?;
3256            fidl::decode!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.root_vmar, decoder, offset + 4, _depth)?;
3257            fidl::decode!(fidl::encoding::HandleType<fidl::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.thread, decoder, offset + 8, _depth)?;
3258            fidl::decode!(
3259                u64,
3260                fidl::encoding::DefaultFuchsiaResourceDialect,
3261                &mut self.entry,
3262                decoder,
3263                offset + 16,
3264                _depth
3265            )?;
3266            fidl::decode!(
3267                u64,
3268                fidl::encoding::DefaultFuchsiaResourceDialect,
3269                &mut self.stack,
3270                decoder,
3271                offset + 24,
3272                _depth
3273            )?;
3274            fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.bootstrap, decoder, offset + 32, _depth)?;
3275            fidl::decode!(
3276                u64,
3277                fidl::encoding::DefaultFuchsiaResourceDialect,
3278                &mut self.vdso_base,
3279                decoder,
3280                offset + 40,
3281                _depth
3282            )?;
3283            fidl::decode!(
3284                u64,
3285                fidl::encoding::DefaultFuchsiaResourceDialect,
3286                &mut self.base,
3287                decoder,
3288                offset + 48,
3289                _depth
3290            )?;
3291            Ok(())
3292        }
3293    }
3294
3295    impl fidl::encoding::ValueTypeMarker for ResolverResolveRequest {
3296        type Borrowed<'a> = &'a Self;
3297        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3298            value
3299        }
3300    }
3301
3302    unsafe impl fidl::encoding::TypeMarker for ResolverResolveRequest {
3303        type Owned = Self;
3304
3305        #[inline(always)]
3306        fn inline_align(_context: fidl::encoding::Context) -> usize {
3307            8
3308        }
3309
3310        #[inline(always)]
3311        fn inline_size(_context: fidl::encoding::Context) -> usize {
3312            16
3313        }
3314    }
3315
3316    unsafe impl<D: fidl::encoding::ResourceDialect>
3317        fidl::encoding::Encode<ResolverResolveRequest, D> for &ResolverResolveRequest
3318    {
3319        #[inline]
3320        unsafe fn encode(
3321            self,
3322            encoder: &mut fidl::encoding::Encoder<'_, D>,
3323            offset: usize,
3324            _depth: fidl::encoding::Depth,
3325        ) -> fidl::Result<()> {
3326            encoder.debug_check_bounds::<ResolverResolveRequest>(offset);
3327            // Delegate to tuple encoding.
3328            fidl::encoding::Encode::<ResolverResolveRequest, D>::encode(
3329                (<fidl::encoding::BoundedString<2048> as fidl::encoding::ValueTypeMarker>::borrow(
3330                    &self.name,
3331                ),),
3332                encoder,
3333                offset,
3334                _depth,
3335            )
3336        }
3337    }
3338    unsafe impl<
3339            D: fidl::encoding::ResourceDialect,
3340            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<2048>, D>,
3341        > fidl::encoding::Encode<ResolverResolveRequest, D> for (T0,)
3342    {
3343        #[inline]
3344        unsafe fn encode(
3345            self,
3346            encoder: &mut fidl::encoding::Encoder<'_, D>,
3347            offset: usize,
3348            depth: fidl::encoding::Depth,
3349        ) -> fidl::Result<()> {
3350            encoder.debug_check_bounds::<ResolverResolveRequest>(offset);
3351            // Zero out padding regions. There's no need to apply masks
3352            // because the unmasked parts will be overwritten by fields.
3353            // Write the fields.
3354            self.0.encode(encoder, offset + 0, depth)?;
3355            Ok(())
3356        }
3357    }
3358
3359    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3360        for ResolverResolveRequest
3361    {
3362        #[inline(always)]
3363        fn new_empty() -> Self {
3364            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<2048>, D) }
3365        }
3366
3367        #[inline]
3368        unsafe fn decode(
3369            &mut self,
3370            decoder: &mut fidl::encoding::Decoder<'_, D>,
3371            offset: usize,
3372            _depth: fidl::encoding::Depth,
3373        ) -> fidl::Result<()> {
3374            decoder.debug_check_bounds::<Self>(offset);
3375            // Verify that padding bytes are zero.
3376            fidl::decode!(
3377                fidl::encoding::BoundedString<2048>,
3378                D,
3379                &mut self.name,
3380                decoder,
3381                offset + 0,
3382                _depth
3383            )?;
3384            Ok(())
3385        }
3386    }
3387
3388    impl fidl::encoding::ResourceTypeMarker for ResolverResolveResponse {
3389        type Borrowed<'a> = &'a mut Self;
3390        fn take_or_borrow<'a>(
3391            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3392        ) -> Self::Borrowed<'a> {
3393            value
3394        }
3395    }
3396
3397    unsafe impl fidl::encoding::TypeMarker for ResolverResolveResponse {
3398        type Owned = Self;
3399
3400        #[inline(always)]
3401        fn inline_align(_context: fidl::encoding::Context) -> usize {
3402            4
3403        }
3404
3405        #[inline(always)]
3406        fn inline_size(_context: fidl::encoding::Context) -> usize {
3407            12
3408        }
3409    }
3410
3411    unsafe impl
3412        fidl::encoding::Encode<
3413            ResolverResolveResponse,
3414            fidl::encoding::DefaultFuchsiaResourceDialect,
3415        > for &mut ResolverResolveResponse
3416    {
3417        #[inline]
3418        unsafe fn encode(
3419            self,
3420            encoder: &mut fidl::encoding::Encoder<
3421                '_,
3422                fidl::encoding::DefaultFuchsiaResourceDialect,
3423            >,
3424            offset: usize,
3425            _depth: fidl::encoding::Depth,
3426        ) -> fidl::Result<()> {
3427            encoder.debug_check_bounds::<ResolverResolveResponse>(offset);
3428            // Delegate to tuple encoding.
3429            fidl::encoding::Encode::<
3430                ResolverResolveResponse,
3431                fidl::encoding::DefaultFuchsiaResourceDialect,
3432            >::encode(
3433                (
3434                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
3435                    <fidl::encoding::Optional<
3436                        fidl::encoding::HandleType<
3437                            fidl::Vmo,
3438                            { fidl::ObjectType::VMO.into_raw() },
3439                            2147483648,
3440                        >,
3441                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3442                        &mut self.executable
3443                    ),
3444                    <fidl::encoding::Optional<
3445                        fidl::encoding::Endpoint<
3446                            fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
3447                        >,
3448                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3449                        &mut self.ldsvc
3450                    ),
3451                ),
3452                encoder,
3453                offset,
3454                _depth,
3455            )
3456        }
3457    }
3458    unsafe impl<
3459            T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
3460            T1: fidl::encoding::Encode<
3461                fidl::encoding::Optional<
3462                    fidl::encoding::HandleType<
3463                        fidl::Vmo,
3464                        { fidl::ObjectType::VMO.into_raw() },
3465                        2147483648,
3466                    >,
3467                >,
3468                fidl::encoding::DefaultFuchsiaResourceDialect,
3469            >,
3470            T2: fidl::encoding::Encode<
3471                fidl::encoding::Optional<
3472                    fidl::encoding::Endpoint<
3473                        fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
3474                    >,
3475                >,
3476                fidl::encoding::DefaultFuchsiaResourceDialect,
3477            >,
3478        >
3479        fidl::encoding::Encode<
3480            ResolverResolveResponse,
3481            fidl::encoding::DefaultFuchsiaResourceDialect,
3482        > for (T0, T1, T2)
3483    {
3484        #[inline]
3485        unsafe fn encode(
3486            self,
3487            encoder: &mut fidl::encoding::Encoder<
3488                '_,
3489                fidl::encoding::DefaultFuchsiaResourceDialect,
3490            >,
3491            offset: usize,
3492            depth: fidl::encoding::Depth,
3493        ) -> fidl::Result<()> {
3494            encoder.debug_check_bounds::<ResolverResolveResponse>(offset);
3495            // Zero out padding regions. There's no need to apply masks
3496            // because the unmasked parts will be overwritten by fields.
3497            // Write the fields.
3498            self.0.encode(encoder, offset + 0, depth)?;
3499            self.1.encode(encoder, offset + 4, depth)?;
3500            self.2.encode(encoder, offset + 8, depth)?;
3501            Ok(())
3502        }
3503    }
3504
3505    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3506        for ResolverResolveResponse
3507    {
3508        #[inline(always)]
3509        fn new_empty() -> Self {
3510            Self {
3511                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
3512                executable: fidl::new_empty!(
3513                    fidl::encoding::Optional<
3514                        fidl::encoding::HandleType<
3515                            fidl::Vmo,
3516                            { fidl::ObjectType::VMO.into_raw() },
3517                            2147483648,
3518                        >,
3519                    >,
3520                    fidl::encoding::DefaultFuchsiaResourceDialect
3521                ),
3522                ldsvc: fidl::new_empty!(
3523                    fidl::encoding::Optional<
3524                        fidl::encoding::Endpoint<
3525                            fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
3526                        >,
3527                    >,
3528                    fidl::encoding::DefaultFuchsiaResourceDialect
3529                ),
3530            }
3531        }
3532
3533        #[inline]
3534        unsafe fn decode(
3535            &mut self,
3536            decoder: &mut fidl::encoding::Decoder<
3537                '_,
3538                fidl::encoding::DefaultFuchsiaResourceDialect,
3539            >,
3540            offset: usize,
3541            _depth: fidl::encoding::Depth,
3542        ) -> fidl::Result<()> {
3543            decoder.debug_check_bounds::<Self>(offset);
3544            // Verify that padding bytes are zero.
3545            fidl::decode!(
3546                i32,
3547                fidl::encoding::DefaultFuchsiaResourceDialect,
3548                &mut self.status,
3549                decoder,
3550                offset + 0,
3551                _depth
3552            )?;
3553            fidl::decode!(
3554                fidl::encoding::Optional<
3555                    fidl::encoding::HandleType<
3556                        fidl::Vmo,
3557                        { fidl::ObjectType::VMO.into_raw() },
3558                        2147483648,
3559                    >,
3560                >,
3561                fidl::encoding::DefaultFuchsiaResourceDialect,
3562                &mut self.executable,
3563                decoder,
3564                offset + 4,
3565                _depth
3566            )?;
3567            fidl::decode!(
3568                fidl::encoding::Optional<
3569                    fidl::encoding::Endpoint<
3570                        fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
3571                    >,
3572                >,
3573                fidl::encoding::DefaultFuchsiaResourceDialect,
3574                &mut self.ldsvc,
3575                decoder,
3576                offset + 8,
3577                _depth
3578            )?;
3579            Ok(())
3580        }
3581    }
3582}