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