Skip to main content

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