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 fidl::endpoints::ControlHandle for LauncherControlHandle {
933    fn shutdown(&self) {
934        self.inner.shutdown()
935    }
936
937    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
938        self.inner.shutdown_with_epitaph(status)
939    }
940
941    fn is_closed(&self) -> bool {
942        self.inner.channel().is_closed()
943    }
944    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
945        self.inner.channel().on_closed()
946    }
947
948    #[cfg(target_os = "fuchsia")]
949    fn signal_peer(
950        &self,
951        clear_mask: zx::Signals,
952        set_mask: zx::Signals,
953    ) -> Result<(), zx_status::Status> {
954        use fidl::Peered;
955        self.inner.channel().signal_peer(clear_mask, set_mask)
956    }
957}
958
959impl LauncherControlHandle {}
960
961#[must_use = "FIDL methods require a response to be sent"]
962#[derive(Debug)]
963pub struct LauncherLaunchResponder {
964    control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
965    tx_id: u32,
966}
967
968/// Set the the channel to be shutdown (see [`LauncherControlHandle::shutdown`])
969/// if the responder is dropped without sending a response, so that the client
970/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
971impl std::ops::Drop for LauncherLaunchResponder {
972    fn drop(&mut self) {
973        self.control_handle.shutdown();
974        // Safety: drops once, never accessed again
975        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
976    }
977}
978
979impl fidl::endpoints::Responder for LauncherLaunchResponder {
980    type ControlHandle = LauncherControlHandle;
981
982    fn control_handle(&self) -> &LauncherControlHandle {
983        &self.control_handle
984    }
985
986    fn drop_without_shutdown(mut self) {
987        // Safety: drops once, never accessed again due to mem::forget
988        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
989        // Prevent Drop from running (which would shut down the channel)
990        std::mem::forget(self);
991    }
992}
993
994impl LauncherLaunchResponder {
995    /// Sends a response to the FIDL transaction.
996    ///
997    /// Sets the channel to shutdown if an error occurs.
998    pub fn send(
999        self,
1000        mut status: i32,
1001        mut process: Option<fidl::Process>,
1002    ) -> Result<(), fidl::Error> {
1003        let _result = self.send_raw(status, process);
1004        if _result.is_err() {
1005            self.control_handle.shutdown();
1006        }
1007        self.drop_without_shutdown();
1008        _result
1009    }
1010
1011    /// Similar to "send" but does not shutdown the channel if an error occurs.
1012    pub fn send_no_shutdown_on_err(
1013        self,
1014        mut status: i32,
1015        mut process: Option<fidl::Process>,
1016    ) -> Result<(), fidl::Error> {
1017        let _result = self.send_raw(status, process);
1018        self.drop_without_shutdown();
1019        _result
1020    }
1021
1022    fn send_raw(
1023        &self,
1024        mut status: i32,
1025        mut process: Option<fidl::Process>,
1026    ) -> Result<(), fidl::Error> {
1027        self.control_handle.inner.send::<LauncherLaunchResponse>(
1028            (status, process),
1029            self.tx_id,
1030            0x11335a9928afbfa4,
1031            fidl::encoding::DynamicFlags::empty(),
1032        )
1033    }
1034}
1035
1036#[must_use = "FIDL methods require a response to be sent"]
1037#[derive(Debug)]
1038pub struct LauncherCreateWithoutStartingResponder {
1039    control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
1040    tx_id: u32,
1041}
1042
1043/// Set the the channel to be shutdown (see [`LauncherControlHandle::shutdown`])
1044/// if the responder is dropped without sending a response, so that the client
1045/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1046impl std::ops::Drop for LauncherCreateWithoutStartingResponder {
1047    fn drop(&mut self) {
1048        self.control_handle.shutdown();
1049        // Safety: drops once, never accessed again
1050        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1051    }
1052}
1053
1054impl fidl::endpoints::Responder for LauncherCreateWithoutStartingResponder {
1055    type ControlHandle = LauncherControlHandle;
1056
1057    fn control_handle(&self) -> &LauncherControlHandle {
1058        &self.control_handle
1059    }
1060
1061    fn drop_without_shutdown(mut self) {
1062        // Safety: drops once, never accessed again due to mem::forget
1063        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1064        // Prevent Drop from running (which would shut down the channel)
1065        std::mem::forget(self);
1066    }
1067}
1068
1069impl LauncherCreateWithoutStartingResponder {
1070    /// Sends a response to the FIDL transaction.
1071    ///
1072    /// Sets the channel to shutdown if an error occurs.
1073    pub fn send(
1074        self,
1075        mut status: i32,
1076        mut data: Option<ProcessStartData>,
1077    ) -> Result<(), fidl::Error> {
1078        let _result = self.send_raw(status, data);
1079        if _result.is_err() {
1080            self.control_handle.shutdown();
1081        }
1082        self.drop_without_shutdown();
1083        _result
1084    }
1085
1086    /// Similar to "send" but does not shutdown the channel if an error occurs.
1087    pub fn send_no_shutdown_on_err(
1088        self,
1089        mut status: i32,
1090        mut data: Option<ProcessStartData>,
1091    ) -> Result<(), fidl::Error> {
1092        let _result = self.send_raw(status, data);
1093        self.drop_without_shutdown();
1094        _result
1095    }
1096
1097    fn send_raw(
1098        &self,
1099        mut status: i32,
1100        mut data: Option<ProcessStartData>,
1101    ) -> Result<(), fidl::Error> {
1102        self.control_handle.inner.send::<LauncherCreateWithoutStartingResponse>(
1103            (status, data.as_mut()),
1104            self.tx_id,
1105            0x755f8263fe51cb61,
1106            fidl::encoding::DynamicFlags::empty(),
1107        )
1108    }
1109}
1110
1111#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1112pub struct ResolverMarker;
1113
1114impl fidl::endpoints::ProtocolMarker for ResolverMarker {
1115    type Proxy = ResolverProxy;
1116    type RequestStream = ResolverRequestStream;
1117    #[cfg(target_os = "fuchsia")]
1118    type SynchronousProxy = ResolverSynchronousProxy;
1119
1120    const DEBUG_NAME: &'static str = "fuchsia.process.Resolver";
1121}
1122impl fidl::endpoints::DiscoverableProtocolMarker for ResolverMarker {}
1123
1124pub trait ResolverProxyInterface: Send + Sync {
1125    type ResolveResponseFut: std::future::Future<
1126            Output = Result<
1127                (
1128                    i32,
1129                    Option<fidl::Vmo>,
1130                    Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
1131                ),
1132                fidl::Error,
1133            >,
1134        > + Send;
1135    fn r#resolve(&self, name: &str) -> Self::ResolveResponseFut;
1136}
1137#[derive(Debug)]
1138#[cfg(target_os = "fuchsia")]
1139pub struct ResolverSynchronousProxy {
1140    client: fidl::client::sync::Client,
1141}
1142
1143#[cfg(target_os = "fuchsia")]
1144impl fidl::endpoints::SynchronousProxy for ResolverSynchronousProxy {
1145    type Proxy = ResolverProxy;
1146    type Protocol = ResolverMarker;
1147
1148    fn from_channel(inner: fidl::Channel) -> Self {
1149        Self::new(inner)
1150    }
1151
1152    fn into_channel(self) -> fidl::Channel {
1153        self.client.into_channel()
1154    }
1155
1156    fn as_channel(&self) -> &fidl::Channel {
1157        self.client.as_channel()
1158    }
1159}
1160
1161#[cfg(target_os = "fuchsia")]
1162impl ResolverSynchronousProxy {
1163    pub fn new(channel: fidl::Channel) -> Self {
1164        Self { client: fidl::client::sync::Client::new(channel) }
1165    }
1166
1167    pub fn into_channel(self) -> fidl::Channel {
1168        self.client.into_channel()
1169    }
1170
1171    /// Waits until an event arrives and returns it. It is safe for other
1172    /// threads to make concurrent requests while waiting for an event.
1173    pub fn wait_for_event(
1174        &self,
1175        deadline: zx::MonotonicInstant,
1176    ) -> Result<ResolverEvent, fidl::Error> {
1177        ResolverEvent::decode(self.client.wait_for_event::<ResolverMarker>(deadline)?)
1178    }
1179
1180    /// Resolves the given `name` to an `executable` and an shared library
1181    /// loader.
1182    ///
1183    /// If present, the `executable` is suitable for use as the `executable`
1184    /// property of `LaunchInfo` -- in particular, it will have `ZX_RIGHT_EXECUTE`.
1185    /// If present, the `ldsvc` is suitable for use as the `PA_LDSVC_LOADER`
1186    /// handle when launching the process.
1187    ///
1188    /// For example, the resolver might locate the given `name` inside a package
1189    /// and return the executable binary from the package as well as a shared
1190    /// library loader scoped to that package.
1191    pub fn r#resolve(
1192        &self,
1193        mut name: &str,
1194        ___deadline: zx::MonotonicInstant,
1195    ) -> Result<
1196        (
1197            i32,
1198            Option<fidl::Vmo>,
1199            Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
1200        ),
1201        fidl::Error,
1202    > {
1203        let _response = self
1204            .client
1205            .send_query::<ResolverResolveRequest, ResolverResolveResponse, ResolverMarker>(
1206                (name,),
1207                0x3c15951efde89c90,
1208                fidl::encoding::DynamicFlags::empty(),
1209                ___deadline,
1210            )?;
1211        Ok((_response.status, _response.executable, _response.ldsvc))
1212    }
1213}
1214
1215#[cfg(target_os = "fuchsia")]
1216impl From<ResolverSynchronousProxy> for zx::NullableHandle {
1217    fn from(value: ResolverSynchronousProxy) -> Self {
1218        value.into_channel().into()
1219    }
1220}
1221
1222#[cfg(target_os = "fuchsia")]
1223impl From<fidl::Channel> for ResolverSynchronousProxy {
1224    fn from(value: fidl::Channel) -> Self {
1225        Self::new(value)
1226    }
1227}
1228
1229#[cfg(target_os = "fuchsia")]
1230impl fidl::endpoints::FromClient for ResolverSynchronousProxy {
1231    type Protocol = ResolverMarker;
1232
1233    fn from_client(value: fidl::endpoints::ClientEnd<ResolverMarker>) -> Self {
1234        Self::new(value.into_channel())
1235    }
1236}
1237
1238#[derive(Debug, Clone)]
1239pub struct ResolverProxy {
1240    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1241}
1242
1243impl fidl::endpoints::Proxy for ResolverProxy {
1244    type Protocol = ResolverMarker;
1245
1246    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1247        Self::new(inner)
1248    }
1249
1250    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1251        self.client.into_channel().map_err(|client| Self { client })
1252    }
1253
1254    fn as_channel(&self) -> &::fidl::AsyncChannel {
1255        self.client.as_channel()
1256    }
1257}
1258
1259impl ResolverProxy {
1260    /// Create a new Proxy for fuchsia.process/Resolver.
1261    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1262        let protocol_name = <ResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1263        Self { client: fidl::client::Client::new(channel, protocol_name) }
1264    }
1265
1266    /// Get a Stream of events from the remote end of the protocol.
1267    ///
1268    /// # Panics
1269    ///
1270    /// Panics if the event stream was already taken.
1271    pub fn take_event_stream(&self) -> ResolverEventStream {
1272        ResolverEventStream { event_receiver: self.client.take_event_receiver() }
1273    }
1274
1275    /// Resolves the given `name` to an `executable` and an shared library
1276    /// loader.
1277    ///
1278    /// If present, the `executable` is suitable for use as the `executable`
1279    /// property of `LaunchInfo` -- in particular, it will have `ZX_RIGHT_EXECUTE`.
1280    /// If present, the `ldsvc` is suitable for use as the `PA_LDSVC_LOADER`
1281    /// handle when launching the process.
1282    ///
1283    /// For example, the resolver might locate the given `name` inside a package
1284    /// and return the executable binary from the package as well as a shared
1285    /// library loader scoped to that package.
1286    pub fn r#resolve(
1287        &self,
1288        mut name: &str,
1289    ) -> fidl::client::QueryResponseFut<
1290        (
1291            i32,
1292            Option<fidl::Vmo>,
1293            Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
1294        ),
1295        fidl::encoding::DefaultFuchsiaResourceDialect,
1296    > {
1297        ResolverProxyInterface::r#resolve(self, name)
1298    }
1299}
1300
1301impl ResolverProxyInterface for ResolverProxy {
1302    type ResolveResponseFut = fidl::client::QueryResponseFut<
1303        (
1304            i32,
1305            Option<fidl::Vmo>,
1306            Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
1307        ),
1308        fidl::encoding::DefaultFuchsiaResourceDialect,
1309    >;
1310    fn r#resolve(&self, mut name: &str) -> Self::ResolveResponseFut {
1311        fn _decode(
1312            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1313        ) -> Result<
1314            (
1315                i32,
1316                Option<fidl::Vmo>,
1317                Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
1318            ),
1319            fidl::Error,
1320        > {
1321            let _response = fidl::client::decode_transaction_body::<
1322                ResolverResolveResponse,
1323                fidl::encoding::DefaultFuchsiaResourceDialect,
1324                0x3c15951efde89c90,
1325            >(_buf?)?;
1326            Ok((_response.status, _response.executable, _response.ldsvc))
1327        }
1328        self.client.send_query_and_decode::<ResolverResolveRequest, (
1329            i32,
1330            Option<fidl::Vmo>,
1331            Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
1332        )>(
1333            (name,), 0x3c15951efde89c90, fidl::encoding::DynamicFlags::empty(), _decode
1334        )
1335    }
1336}
1337
1338pub struct ResolverEventStream {
1339    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1340}
1341
1342impl std::marker::Unpin for ResolverEventStream {}
1343
1344impl futures::stream::FusedStream for ResolverEventStream {
1345    fn is_terminated(&self) -> bool {
1346        self.event_receiver.is_terminated()
1347    }
1348}
1349
1350impl futures::Stream for ResolverEventStream {
1351    type Item = Result<ResolverEvent, fidl::Error>;
1352
1353    fn poll_next(
1354        mut self: std::pin::Pin<&mut Self>,
1355        cx: &mut std::task::Context<'_>,
1356    ) -> std::task::Poll<Option<Self::Item>> {
1357        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1358            &mut self.event_receiver,
1359            cx
1360        )?) {
1361            Some(buf) => std::task::Poll::Ready(Some(ResolverEvent::decode(buf))),
1362            None => std::task::Poll::Ready(None),
1363        }
1364    }
1365}
1366
1367#[derive(Debug)]
1368pub enum ResolverEvent {}
1369
1370impl ResolverEvent {
1371    /// Decodes a message buffer as a [`ResolverEvent`].
1372    fn decode(
1373        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1374    ) -> Result<ResolverEvent, fidl::Error> {
1375        let (bytes, _handles) = buf.split_mut();
1376        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1377        debug_assert_eq!(tx_header.tx_id, 0);
1378        match tx_header.ordinal {
1379            _ => Err(fidl::Error::UnknownOrdinal {
1380                ordinal: tx_header.ordinal,
1381                protocol_name: <ResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1382            }),
1383        }
1384    }
1385}
1386
1387/// A Stream of incoming requests for fuchsia.process/Resolver.
1388pub struct ResolverRequestStream {
1389    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1390    is_terminated: bool,
1391}
1392
1393impl std::marker::Unpin for ResolverRequestStream {}
1394
1395impl futures::stream::FusedStream for ResolverRequestStream {
1396    fn is_terminated(&self) -> bool {
1397        self.is_terminated
1398    }
1399}
1400
1401impl fidl::endpoints::RequestStream for ResolverRequestStream {
1402    type Protocol = ResolverMarker;
1403    type ControlHandle = ResolverControlHandle;
1404
1405    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1406        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1407    }
1408
1409    fn control_handle(&self) -> Self::ControlHandle {
1410        ResolverControlHandle { inner: self.inner.clone() }
1411    }
1412
1413    fn into_inner(
1414        self,
1415    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1416    {
1417        (self.inner, self.is_terminated)
1418    }
1419
1420    fn from_inner(
1421        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1422        is_terminated: bool,
1423    ) -> Self {
1424        Self { inner, is_terminated }
1425    }
1426}
1427
1428impl futures::Stream for ResolverRequestStream {
1429    type Item = Result<ResolverRequest, fidl::Error>;
1430
1431    fn poll_next(
1432        mut self: std::pin::Pin<&mut Self>,
1433        cx: &mut std::task::Context<'_>,
1434    ) -> std::task::Poll<Option<Self::Item>> {
1435        let this = &mut *self;
1436        if this.inner.check_shutdown(cx) {
1437            this.is_terminated = true;
1438            return std::task::Poll::Ready(None);
1439        }
1440        if this.is_terminated {
1441            panic!("polled ResolverRequestStream after completion");
1442        }
1443        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1444            |bytes, handles| {
1445                match this.inner.channel().read_etc(cx, bytes, handles) {
1446                    std::task::Poll::Ready(Ok(())) => {}
1447                    std::task::Poll::Pending => return std::task::Poll::Pending,
1448                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1449                        this.is_terminated = true;
1450                        return std::task::Poll::Ready(None);
1451                    }
1452                    std::task::Poll::Ready(Err(e)) => {
1453                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1454                            e.into(),
1455                        ))));
1456                    }
1457                }
1458
1459                // A message has been received from the channel
1460                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1461
1462                std::task::Poll::Ready(Some(match header.ordinal {
1463                    0x3c15951efde89c90 => {
1464                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1465                        let mut req = fidl::new_empty!(
1466                            ResolverResolveRequest,
1467                            fidl::encoding::DefaultFuchsiaResourceDialect
1468                        );
1469                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ResolverResolveRequest>(&header, _body_bytes, handles, &mut req)?;
1470                        let control_handle = ResolverControlHandle { inner: this.inner.clone() };
1471                        Ok(ResolverRequest::Resolve {
1472                            name: req.name,
1473
1474                            responder: ResolverResolveResponder {
1475                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1476                                tx_id: header.tx_id,
1477                            },
1478                        })
1479                    }
1480                    _ => Err(fidl::Error::UnknownOrdinal {
1481                        ordinal: header.ordinal,
1482                        protocol_name:
1483                            <ResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1484                    }),
1485                }))
1486            },
1487        )
1488    }
1489}
1490
1491/// An interface for resolving names to executables and library loaders.
1492///
1493/// An executable itself is often not sufficient to create a working process
1494/// because many executables also load shared libraries. On Fuchsia, there is no
1495/// global pool of shared libraries. Instead, every process has an associated
1496/// `fuchsia.ldsvc.Loader`, which provides access to a private pool of shared
1497/// libraries appropriate for that process.
1498///
1499/// This interface provides a protocol for resolving a name into both the
1500/// `zx.Handle:VMO` for the executable and the `fuchsia.ldsvc.Loader` for its
1501/// associated shared libraries.
1502///
1503/// This interface is rarely used directly. Instead, `fdio_spawn` and
1504/// `fdio_spawn_etc` use this interface internally when they try to run a file
1505/// with a `#!resolve` directive.
1506#[derive(Debug)]
1507pub enum ResolverRequest {
1508    /// Resolves the given `name` to an `executable` and an shared library
1509    /// loader.
1510    ///
1511    /// If present, the `executable` is suitable for use as the `executable`
1512    /// property of `LaunchInfo` -- in particular, it will have `ZX_RIGHT_EXECUTE`.
1513    /// If present, the `ldsvc` is suitable for use as the `PA_LDSVC_LOADER`
1514    /// handle when launching the process.
1515    ///
1516    /// For example, the resolver might locate the given `name` inside a package
1517    /// and return the executable binary from the package as well as a shared
1518    /// library loader scoped to that package.
1519    Resolve { name: String, responder: ResolverResolveResponder },
1520}
1521
1522impl ResolverRequest {
1523    #[allow(irrefutable_let_patterns)]
1524    pub fn into_resolve(self) -> Option<(String, ResolverResolveResponder)> {
1525        if let ResolverRequest::Resolve { name, responder } = self {
1526            Some((name, responder))
1527        } else {
1528            None
1529        }
1530    }
1531
1532    /// Name of the method defined in FIDL
1533    pub fn method_name(&self) -> &'static str {
1534        match *self {
1535            ResolverRequest::Resolve { .. } => "resolve",
1536        }
1537    }
1538}
1539
1540#[derive(Debug, Clone)]
1541pub struct ResolverControlHandle {
1542    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1543}
1544
1545impl fidl::endpoints::ControlHandle for ResolverControlHandle {
1546    fn shutdown(&self) {
1547        self.inner.shutdown()
1548    }
1549
1550    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1551        self.inner.shutdown_with_epitaph(status)
1552    }
1553
1554    fn is_closed(&self) -> bool {
1555        self.inner.channel().is_closed()
1556    }
1557    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1558        self.inner.channel().on_closed()
1559    }
1560
1561    #[cfg(target_os = "fuchsia")]
1562    fn signal_peer(
1563        &self,
1564        clear_mask: zx::Signals,
1565        set_mask: zx::Signals,
1566    ) -> Result<(), zx_status::Status> {
1567        use fidl::Peered;
1568        self.inner.channel().signal_peer(clear_mask, set_mask)
1569    }
1570}
1571
1572impl ResolverControlHandle {}
1573
1574#[must_use = "FIDL methods require a response to be sent"]
1575#[derive(Debug)]
1576pub struct ResolverResolveResponder {
1577    control_handle: std::mem::ManuallyDrop<ResolverControlHandle>,
1578    tx_id: u32,
1579}
1580
1581/// Set the the channel to be shutdown (see [`ResolverControlHandle::shutdown`])
1582/// if the responder is dropped without sending a response, so that the client
1583/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1584impl std::ops::Drop for ResolverResolveResponder {
1585    fn drop(&mut self) {
1586        self.control_handle.shutdown();
1587        // Safety: drops once, never accessed again
1588        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1589    }
1590}
1591
1592impl fidl::endpoints::Responder for ResolverResolveResponder {
1593    type ControlHandle = ResolverControlHandle;
1594
1595    fn control_handle(&self) -> &ResolverControlHandle {
1596        &self.control_handle
1597    }
1598
1599    fn drop_without_shutdown(mut self) {
1600        // Safety: drops once, never accessed again due to mem::forget
1601        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1602        // Prevent Drop from running (which would shut down the channel)
1603        std::mem::forget(self);
1604    }
1605}
1606
1607impl ResolverResolveResponder {
1608    /// Sends a response to the FIDL transaction.
1609    ///
1610    /// Sets the channel to shutdown if an error occurs.
1611    pub fn send(
1612        self,
1613        mut status: i32,
1614        mut executable: Option<fidl::Vmo>,
1615        mut ldsvc: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
1616    ) -> Result<(), fidl::Error> {
1617        let _result = self.send_raw(status, executable, ldsvc);
1618        if _result.is_err() {
1619            self.control_handle.shutdown();
1620        }
1621        self.drop_without_shutdown();
1622        _result
1623    }
1624
1625    /// Similar to "send" but does not shutdown the channel if an error occurs.
1626    pub fn send_no_shutdown_on_err(
1627        self,
1628        mut status: i32,
1629        mut executable: Option<fidl::Vmo>,
1630        mut ldsvc: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
1631    ) -> Result<(), fidl::Error> {
1632        let _result = self.send_raw(status, executable, ldsvc);
1633        self.drop_without_shutdown();
1634        _result
1635    }
1636
1637    fn send_raw(
1638        &self,
1639        mut status: i32,
1640        mut executable: Option<fidl::Vmo>,
1641        mut ldsvc: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>>,
1642    ) -> Result<(), fidl::Error> {
1643        self.control_handle.inner.send::<ResolverResolveResponse>(
1644            (status, executable, ldsvc),
1645            self.tx_id,
1646            0x3c15951efde89c90,
1647            fidl::encoding::DynamicFlags::empty(),
1648        )
1649    }
1650}
1651
1652mod internal {
1653    use super::*;
1654
1655    impl fidl::encoding::ResourceTypeMarker for HandleInfo {
1656        type Borrowed<'a> = &'a mut Self;
1657        fn take_or_borrow<'a>(
1658            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1659        ) -> Self::Borrowed<'a> {
1660            value
1661        }
1662    }
1663
1664    unsafe impl fidl::encoding::TypeMarker for HandleInfo {
1665        type Owned = Self;
1666
1667        #[inline(always)]
1668        fn inline_align(_context: fidl::encoding::Context) -> usize {
1669            4
1670        }
1671
1672        #[inline(always)]
1673        fn inline_size(_context: fidl::encoding::Context) -> usize {
1674            8
1675        }
1676    }
1677
1678    unsafe impl fidl::encoding::Encode<HandleInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
1679        for &mut HandleInfo
1680    {
1681        #[inline]
1682        unsafe fn encode(
1683            self,
1684            encoder: &mut fidl::encoding::Encoder<
1685                '_,
1686                fidl::encoding::DefaultFuchsiaResourceDialect,
1687            >,
1688            offset: usize,
1689            _depth: fidl::encoding::Depth,
1690        ) -> fidl::Result<()> {
1691            encoder.debug_check_bounds::<HandleInfo>(offset);
1692            // Delegate to tuple encoding.
1693            fidl::encoding::Encode::<HandleInfo, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1694                (
1695                    <fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
1696                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1697                ),
1698                encoder, offset, _depth
1699            )
1700        }
1701    }
1702    unsafe impl<
1703        T0: fidl::encoding::Encode<
1704                fidl::encoding::HandleType<
1705                    fidl::NullableHandle,
1706                    { fidl::ObjectType::NONE.into_raw() },
1707                    2147483648,
1708                >,
1709                fidl::encoding::DefaultFuchsiaResourceDialect,
1710            >,
1711        T1: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
1712    > fidl::encoding::Encode<HandleInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
1713        for (T0, T1)
1714    {
1715        #[inline]
1716        unsafe fn encode(
1717            self,
1718            encoder: &mut fidl::encoding::Encoder<
1719                '_,
1720                fidl::encoding::DefaultFuchsiaResourceDialect,
1721            >,
1722            offset: usize,
1723            depth: fidl::encoding::Depth,
1724        ) -> fidl::Result<()> {
1725            encoder.debug_check_bounds::<HandleInfo>(offset);
1726            // Zero out padding regions. There's no need to apply masks
1727            // because the unmasked parts will be overwritten by fields.
1728            // Write the fields.
1729            self.0.encode(encoder, offset + 0, depth)?;
1730            self.1.encode(encoder, offset + 4, depth)?;
1731            Ok(())
1732        }
1733    }
1734
1735    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for HandleInfo {
1736        #[inline(always)]
1737        fn new_empty() -> Self {
1738            Self {
1739                handle: fidl::new_empty!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1740                id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
1741            }
1742        }
1743
1744        #[inline]
1745        unsafe fn decode(
1746            &mut self,
1747            decoder: &mut fidl::encoding::Decoder<
1748                '_,
1749                fidl::encoding::DefaultFuchsiaResourceDialect,
1750            >,
1751            offset: usize,
1752            _depth: fidl::encoding::Depth,
1753        ) -> fidl::Result<()> {
1754            decoder.debug_check_bounds::<Self>(offset);
1755            // Verify that padding bytes are zero.
1756            fidl::decode!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.handle, decoder, offset + 0, _depth)?;
1757            fidl::decode!(
1758                u32,
1759                fidl::encoding::DefaultFuchsiaResourceDialect,
1760                &mut self.id,
1761                decoder,
1762                offset + 4,
1763                _depth
1764            )?;
1765            Ok(())
1766        }
1767    }
1768
1769    impl fidl::encoding::ResourceTypeMarker for LaunchInfo {
1770        type Borrowed<'a> = &'a mut Self;
1771        fn take_or_borrow<'a>(
1772            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1773        ) -> Self::Borrowed<'a> {
1774            value
1775        }
1776    }
1777
1778    unsafe impl fidl::encoding::TypeMarker for LaunchInfo {
1779        type Owned = Self;
1780
1781        #[inline(always)]
1782        fn inline_align(_context: fidl::encoding::Context) -> usize {
1783            8
1784        }
1785
1786        #[inline(always)]
1787        fn inline_size(_context: fidl::encoding::Context) -> usize {
1788            24
1789        }
1790    }
1791
1792    unsafe impl fidl::encoding::Encode<LaunchInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
1793        for &mut LaunchInfo
1794    {
1795        #[inline]
1796        unsafe fn encode(
1797            self,
1798            encoder: &mut fidl::encoding::Encoder<
1799                '_,
1800                fidl::encoding::DefaultFuchsiaResourceDialect,
1801            >,
1802            offset: usize,
1803            _depth: fidl::encoding::Depth,
1804        ) -> fidl::Result<()> {
1805            encoder.debug_check_bounds::<LaunchInfo>(offset);
1806            // Delegate to tuple encoding.
1807            fidl::encoding::Encode::<LaunchInfo, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1808                (
1809                    <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.executable),
1810                    <fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.job),
1811                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
1812                ),
1813                encoder, offset, _depth
1814            )
1815        }
1816    }
1817    unsafe impl<
1818        T0: fidl::encoding::Encode<
1819                fidl::encoding::HandleType<
1820                    fidl::Vmo,
1821                    { fidl::ObjectType::VMO.into_raw() },
1822                    2147483648,
1823                >,
1824                fidl::encoding::DefaultFuchsiaResourceDialect,
1825            >,
1826        T1: fidl::encoding::Encode<
1827                fidl::encoding::HandleType<
1828                    fidl::Job,
1829                    { fidl::ObjectType::JOB.into_raw() },
1830                    2147483648,
1831                >,
1832                fidl::encoding::DefaultFuchsiaResourceDialect,
1833            >,
1834        T2: fidl::encoding::Encode<
1835                fidl::encoding::BoundedString<32>,
1836                fidl::encoding::DefaultFuchsiaResourceDialect,
1837            >,
1838    > fidl::encoding::Encode<LaunchInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
1839        for (T0, T1, T2)
1840    {
1841        #[inline]
1842        unsafe fn encode(
1843            self,
1844            encoder: &mut fidl::encoding::Encoder<
1845                '_,
1846                fidl::encoding::DefaultFuchsiaResourceDialect,
1847            >,
1848            offset: usize,
1849            depth: fidl::encoding::Depth,
1850        ) -> fidl::Result<()> {
1851            encoder.debug_check_bounds::<LaunchInfo>(offset);
1852            // Zero out padding regions. There's no need to apply masks
1853            // because the unmasked parts will be overwritten by fields.
1854            // Write the fields.
1855            self.0.encode(encoder, offset + 0, depth)?;
1856            self.1.encode(encoder, offset + 4, depth)?;
1857            self.2.encode(encoder, offset + 8, depth)?;
1858            Ok(())
1859        }
1860    }
1861
1862    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for LaunchInfo {
1863        #[inline(always)]
1864        fn new_empty() -> Self {
1865            Self {
1866                executable: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1867                job: fidl::new_empty!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1868                name: fidl::new_empty!(
1869                    fidl::encoding::BoundedString<32>,
1870                    fidl::encoding::DefaultFuchsiaResourceDialect
1871                ),
1872            }
1873        }
1874
1875        #[inline]
1876        unsafe fn decode(
1877            &mut self,
1878            decoder: &mut fidl::encoding::Decoder<
1879                '_,
1880                fidl::encoding::DefaultFuchsiaResourceDialect,
1881            >,
1882            offset: usize,
1883            _depth: fidl::encoding::Depth,
1884        ) -> fidl::Result<()> {
1885            decoder.debug_check_bounds::<Self>(offset);
1886            // Verify that padding bytes are zero.
1887            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.executable, decoder, offset + 0, _depth)?;
1888            fidl::decode!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.job, decoder, offset + 4, _depth)?;
1889            fidl::decode!(
1890                fidl::encoding::BoundedString<32>,
1891                fidl::encoding::DefaultFuchsiaResourceDialect,
1892                &mut self.name,
1893                decoder,
1894                offset + 8,
1895                _depth
1896            )?;
1897            Ok(())
1898        }
1899    }
1900
1901    impl fidl::encoding::ResourceTypeMarker for LauncherAddHandlesRequest {
1902        type Borrowed<'a> = &'a mut Self;
1903        fn take_or_borrow<'a>(
1904            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1905        ) -> Self::Borrowed<'a> {
1906            value
1907        }
1908    }
1909
1910    unsafe impl fidl::encoding::TypeMarker for LauncherAddHandlesRequest {
1911        type Owned = Self;
1912
1913        #[inline(always)]
1914        fn inline_align(_context: fidl::encoding::Context) -> usize {
1915            8
1916        }
1917
1918        #[inline(always)]
1919        fn inline_size(_context: fidl::encoding::Context) -> usize {
1920            16
1921        }
1922    }
1923
1924    unsafe impl
1925        fidl::encoding::Encode<
1926            LauncherAddHandlesRequest,
1927            fidl::encoding::DefaultFuchsiaResourceDialect,
1928        > for &mut LauncherAddHandlesRequest
1929    {
1930        #[inline]
1931        unsafe fn encode(
1932            self,
1933            encoder: &mut fidl::encoding::Encoder<
1934                '_,
1935                fidl::encoding::DefaultFuchsiaResourceDialect,
1936            >,
1937            offset: usize,
1938            _depth: fidl::encoding::Depth,
1939        ) -> fidl::Result<()> {
1940            encoder.debug_check_bounds::<LauncherAddHandlesRequest>(offset);
1941            // Delegate to tuple encoding.
1942            fidl::encoding::Encode::<LauncherAddHandlesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1943                (
1944                    <fidl::encoding::UnboundedVector<HandleInfo> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handles),
1945                ),
1946                encoder, offset, _depth
1947            )
1948        }
1949    }
1950    unsafe impl<
1951        T0: fidl::encoding::Encode<
1952                fidl::encoding::UnboundedVector<HandleInfo>,
1953                fidl::encoding::DefaultFuchsiaResourceDialect,
1954            >,
1955    >
1956        fidl::encoding::Encode<
1957            LauncherAddHandlesRequest,
1958            fidl::encoding::DefaultFuchsiaResourceDialect,
1959        > for (T0,)
1960    {
1961        #[inline]
1962        unsafe fn encode(
1963            self,
1964            encoder: &mut fidl::encoding::Encoder<
1965                '_,
1966                fidl::encoding::DefaultFuchsiaResourceDialect,
1967            >,
1968            offset: usize,
1969            depth: fidl::encoding::Depth,
1970        ) -> fidl::Result<()> {
1971            encoder.debug_check_bounds::<LauncherAddHandlesRequest>(offset);
1972            // Zero out padding regions. There's no need to apply masks
1973            // because the unmasked parts will be overwritten by fields.
1974            // Write the fields.
1975            self.0.encode(encoder, offset + 0, depth)?;
1976            Ok(())
1977        }
1978    }
1979
1980    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1981        for LauncherAddHandlesRequest
1982    {
1983        #[inline(always)]
1984        fn new_empty() -> Self {
1985            Self {
1986                handles: fidl::new_empty!(
1987                    fidl::encoding::UnboundedVector<HandleInfo>,
1988                    fidl::encoding::DefaultFuchsiaResourceDialect
1989                ),
1990            }
1991        }
1992
1993        #[inline]
1994        unsafe fn decode(
1995            &mut self,
1996            decoder: &mut fidl::encoding::Decoder<
1997                '_,
1998                fidl::encoding::DefaultFuchsiaResourceDialect,
1999            >,
2000            offset: usize,
2001            _depth: fidl::encoding::Depth,
2002        ) -> fidl::Result<()> {
2003            decoder.debug_check_bounds::<Self>(offset);
2004            // Verify that padding bytes are zero.
2005            fidl::decode!(
2006                fidl::encoding::UnboundedVector<HandleInfo>,
2007                fidl::encoding::DefaultFuchsiaResourceDialect,
2008                &mut self.handles,
2009                decoder,
2010                offset + 0,
2011                _depth
2012            )?;
2013            Ok(())
2014        }
2015    }
2016
2017    impl fidl::encoding::ResourceTypeMarker for LauncherAddNamesRequest {
2018        type Borrowed<'a> = &'a mut Self;
2019        fn take_or_borrow<'a>(
2020            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2021        ) -> Self::Borrowed<'a> {
2022            value
2023        }
2024    }
2025
2026    unsafe impl fidl::encoding::TypeMarker for LauncherAddNamesRequest {
2027        type Owned = Self;
2028
2029        #[inline(always)]
2030        fn inline_align(_context: fidl::encoding::Context) -> usize {
2031            8
2032        }
2033
2034        #[inline(always)]
2035        fn inline_size(_context: fidl::encoding::Context) -> usize {
2036            16
2037        }
2038    }
2039
2040    unsafe impl
2041        fidl::encoding::Encode<
2042            LauncherAddNamesRequest,
2043            fidl::encoding::DefaultFuchsiaResourceDialect,
2044        > for &mut LauncherAddNamesRequest
2045    {
2046        #[inline]
2047        unsafe fn encode(
2048            self,
2049            encoder: &mut fidl::encoding::Encoder<
2050                '_,
2051                fidl::encoding::DefaultFuchsiaResourceDialect,
2052            >,
2053            offset: usize,
2054            _depth: fidl::encoding::Depth,
2055        ) -> fidl::Result<()> {
2056            encoder.debug_check_bounds::<LauncherAddNamesRequest>(offset);
2057            // Delegate to tuple encoding.
2058            fidl::encoding::Encode::<LauncherAddNamesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2059                (
2060                    <fidl::encoding::UnboundedVector<NameInfo> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.names),
2061                ),
2062                encoder, offset, _depth
2063            )
2064        }
2065    }
2066    unsafe impl<
2067        T0: fidl::encoding::Encode<
2068                fidl::encoding::UnboundedVector<NameInfo>,
2069                fidl::encoding::DefaultFuchsiaResourceDialect,
2070            >,
2071    >
2072        fidl::encoding::Encode<
2073            LauncherAddNamesRequest,
2074            fidl::encoding::DefaultFuchsiaResourceDialect,
2075        > for (T0,)
2076    {
2077        #[inline]
2078        unsafe fn encode(
2079            self,
2080            encoder: &mut fidl::encoding::Encoder<
2081                '_,
2082                fidl::encoding::DefaultFuchsiaResourceDialect,
2083            >,
2084            offset: usize,
2085            depth: fidl::encoding::Depth,
2086        ) -> fidl::Result<()> {
2087            encoder.debug_check_bounds::<LauncherAddNamesRequest>(offset);
2088            // Zero out padding regions. There's no need to apply masks
2089            // because the unmasked parts will be overwritten by fields.
2090            // Write the fields.
2091            self.0.encode(encoder, offset + 0, depth)?;
2092            Ok(())
2093        }
2094    }
2095
2096    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2097        for LauncherAddNamesRequest
2098    {
2099        #[inline(always)]
2100        fn new_empty() -> Self {
2101            Self {
2102                names: fidl::new_empty!(
2103                    fidl::encoding::UnboundedVector<NameInfo>,
2104                    fidl::encoding::DefaultFuchsiaResourceDialect
2105                ),
2106            }
2107        }
2108
2109        #[inline]
2110        unsafe fn decode(
2111            &mut self,
2112            decoder: &mut fidl::encoding::Decoder<
2113                '_,
2114                fidl::encoding::DefaultFuchsiaResourceDialect,
2115            >,
2116            offset: usize,
2117            _depth: fidl::encoding::Depth,
2118        ) -> fidl::Result<()> {
2119            decoder.debug_check_bounds::<Self>(offset);
2120            // Verify that padding bytes are zero.
2121            fidl::decode!(
2122                fidl::encoding::UnboundedVector<NameInfo>,
2123                fidl::encoding::DefaultFuchsiaResourceDialect,
2124                &mut self.names,
2125                decoder,
2126                offset + 0,
2127                _depth
2128            )?;
2129            Ok(())
2130        }
2131    }
2132
2133    impl fidl::encoding::ResourceTypeMarker for LauncherCreateWithoutStartingRequest {
2134        type Borrowed<'a> = &'a mut Self;
2135        fn take_or_borrow<'a>(
2136            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2137        ) -> Self::Borrowed<'a> {
2138            value
2139        }
2140    }
2141
2142    unsafe impl fidl::encoding::TypeMarker for LauncherCreateWithoutStartingRequest {
2143        type Owned = Self;
2144
2145        #[inline(always)]
2146        fn inline_align(_context: fidl::encoding::Context) -> usize {
2147            8
2148        }
2149
2150        #[inline(always)]
2151        fn inline_size(_context: fidl::encoding::Context) -> usize {
2152            24
2153        }
2154    }
2155
2156    unsafe impl
2157        fidl::encoding::Encode<
2158            LauncherCreateWithoutStartingRequest,
2159            fidl::encoding::DefaultFuchsiaResourceDialect,
2160        > for &mut LauncherCreateWithoutStartingRequest
2161    {
2162        #[inline]
2163        unsafe fn encode(
2164            self,
2165            encoder: &mut fidl::encoding::Encoder<
2166                '_,
2167                fidl::encoding::DefaultFuchsiaResourceDialect,
2168            >,
2169            offset: usize,
2170            _depth: fidl::encoding::Depth,
2171        ) -> fidl::Result<()> {
2172            encoder.debug_check_bounds::<LauncherCreateWithoutStartingRequest>(offset);
2173            // Delegate to tuple encoding.
2174            fidl::encoding::Encode::<
2175                LauncherCreateWithoutStartingRequest,
2176                fidl::encoding::DefaultFuchsiaResourceDialect,
2177            >::encode(
2178                (<LaunchInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2179                    &mut self.info,
2180                ),),
2181                encoder,
2182                offset,
2183                _depth,
2184            )
2185        }
2186    }
2187    unsafe impl<
2188        T0: fidl::encoding::Encode<LaunchInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
2189    >
2190        fidl::encoding::Encode<
2191            LauncherCreateWithoutStartingRequest,
2192            fidl::encoding::DefaultFuchsiaResourceDialect,
2193        > for (T0,)
2194    {
2195        #[inline]
2196        unsafe fn encode(
2197            self,
2198            encoder: &mut fidl::encoding::Encoder<
2199                '_,
2200                fidl::encoding::DefaultFuchsiaResourceDialect,
2201            >,
2202            offset: usize,
2203            depth: fidl::encoding::Depth,
2204        ) -> fidl::Result<()> {
2205            encoder.debug_check_bounds::<LauncherCreateWithoutStartingRequest>(offset);
2206            // Zero out padding regions. There's no need to apply masks
2207            // because the unmasked parts will be overwritten by fields.
2208            // Write the fields.
2209            self.0.encode(encoder, offset + 0, depth)?;
2210            Ok(())
2211        }
2212    }
2213
2214    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2215        for LauncherCreateWithoutStartingRequest
2216    {
2217        #[inline(always)]
2218        fn new_empty() -> Self {
2219            Self {
2220                info: fidl::new_empty!(LaunchInfo, fidl::encoding::DefaultFuchsiaResourceDialect),
2221            }
2222        }
2223
2224        #[inline]
2225        unsafe fn decode(
2226            &mut self,
2227            decoder: &mut fidl::encoding::Decoder<
2228                '_,
2229                fidl::encoding::DefaultFuchsiaResourceDialect,
2230            >,
2231            offset: usize,
2232            _depth: fidl::encoding::Depth,
2233        ) -> fidl::Result<()> {
2234            decoder.debug_check_bounds::<Self>(offset);
2235            // Verify that padding bytes are zero.
2236            fidl::decode!(
2237                LaunchInfo,
2238                fidl::encoding::DefaultFuchsiaResourceDialect,
2239                &mut self.info,
2240                decoder,
2241                offset + 0,
2242                _depth
2243            )?;
2244            Ok(())
2245        }
2246    }
2247
2248    impl fidl::encoding::ResourceTypeMarker for LauncherCreateWithoutStartingResponse {
2249        type Borrowed<'a> = &'a mut Self;
2250        fn take_or_borrow<'a>(
2251            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2252        ) -> Self::Borrowed<'a> {
2253            value
2254        }
2255    }
2256
2257    unsafe impl fidl::encoding::TypeMarker for LauncherCreateWithoutStartingResponse {
2258        type Owned = Self;
2259
2260        #[inline(always)]
2261        fn inline_align(_context: fidl::encoding::Context) -> usize {
2262            8
2263        }
2264
2265        #[inline(always)]
2266        fn inline_size(_context: fidl::encoding::Context) -> usize {
2267            16
2268        }
2269    }
2270
2271    unsafe impl
2272        fidl::encoding::Encode<
2273            LauncherCreateWithoutStartingResponse,
2274            fidl::encoding::DefaultFuchsiaResourceDialect,
2275        > for &mut LauncherCreateWithoutStartingResponse
2276    {
2277        #[inline]
2278        unsafe fn encode(
2279            self,
2280            encoder: &mut fidl::encoding::Encoder<
2281                '_,
2282                fidl::encoding::DefaultFuchsiaResourceDialect,
2283            >,
2284            offset: usize,
2285            _depth: fidl::encoding::Depth,
2286        ) -> fidl::Result<()> {
2287            encoder.debug_check_bounds::<LauncherCreateWithoutStartingResponse>(offset);
2288            // Delegate to tuple encoding.
2289            fidl::encoding::Encode::<LauncherCreateWithoutStartingResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2290                (
2291                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2292                    <fidl::encoding::Boxed<ProcessStartData> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.data),
2293                ),
2294                encoder, offset, _depth
2295            )
2296        }
2297    }
2298    unsafe impl<
2299        T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2300        T1: fidl::encoding::Encode<
2301                fidl::encoding::Boxed<ProcessStartData>,
2302                fidl::encoding::DefaultFuchsiaResourceDialect,
2303            >,
2304    >
2305        fidl::encoding::Encode<
2306            LauncherCreateWithoutStartingResponse,
2307            fidl::encoding::DefaultFuchsiaResourceDialect,
2308        > for (T0, T1)
2309    {
2310        #[inline]
2311        unsafe fn encode(
2312            self,
2313            encoder: &mut fidl::encoding::Encoder<
2314                '_,
2315                fidl::encoding::DefaultFuchsiaResourceDialect,
2316            >,
2317            offset: usize,
2318            depth: fidl::encoding::Depth,
2319        ) -> fidl::Result<()> {
2320            encoder.debug_check_bounds::<LauncherCreateWithoutStartingResponse>(offset);
2321            // Zero out padding regions. There's no need to apply masks
2322            // because the unmasked parts will be overwritten by fields.
2323            unsafe {
2324                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2325                (ptr as *mut u64).write_unaligned(0);
2326            }
2327            // Write the fields.
2328            self.0.encode(encoder, offset + 0, depth)?;
2329            self.1.encode(encoder, offset + 8, depth)?;
2330            Ok(())
2331        }
2332    }
2333
2334    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2335        for LauncherCreateWithoutStartingResponse
2336    {
2337        #[inline(always)]
2338        fn new_empty() -> Self {
2339            Self {
2340                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
2341                data: fidl::new_empty!(
2342                    fidl::encoding::Boxed<ProcessStartData>,
2343                    fidl::encoding::DefaultFuchsiaResourceDialect
2344                ),
2345            }
2346        }
2347
2348        #[inline]
2349        unsafe fn decode(
2350            &mut self,
2351            decoder: &mut fidl::encoding::Decoder<
2352                '_,
2353                fidl::encoding::DefaultFuchsiaResourceDialect,
2354            >,
2355            offset: usize,
2356            _depth: fidl::encoding::Depth,
2357        ) -> fidl::Result<()> {
2358            decoder.debug_check_bounds::<Self>(offset);
2359            // Verify that padding bytes are zero.
2360            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2361            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2362            let mask = 0xffffffff00000000u64;
2363            let maskedval = padval & mask;
2364            if maskedval != 0 {
2365                return Err(fidl::Error::NonZeroPadding {
2366                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2367                });
2368            }
2369            fidl::decode!(
2370                i32,
2371                fidl::encoding::DefaultFuchsiaResourceDialect,
2372                &mut self.status,
2373                decoder,
2374                offset + 0,
2375                _depth
2376            )?;
2377            fidl::decode!(
2378                fidl::encoding::Boxed<ProcessStartData>,
2379                fidl::encoding::DefaultFuchsiaResourceDialect,
2380                &mut self.data,
2381                decoder,
2382                offset + 8,
2383                _depth
2384            )?;
2385            Ok(())
2386        }
2387    }
2388
2389    impl fidl::encoding::ResourceTypeMarker for LauncherLaunchRequest {
2390        type Borrowed<'a> = &'a mut Self;
2391        fn take_or_borrow<'a>(
2392            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2393        ) -> Self::Borrowed<'a> {
2394            value
2395        }
2396    }
2397
2398    unsafe impl fidl::encoding::TypeMarker for LauncherLaunchRequest {
2399        type Owned = Self;
2400
2401        #[inline(always)]
2402        fn inline_align(_context: fidl::encoding::Context) -> usize {
2403            8
2404        }
2405
2406        #[inline(always)]
2407        fn inline_size(_context: fidl::encoding::Context) -> usize {
2408            24
2409        }
2410    }
2411
2412    unsafe impl
2413        fidl::encoding::Encode<LauncherLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2414        for &mut LauncherLaunchRequest
2415    {
2416        #[inline]
2417        unsafe fn encode(
2418            self,
2419            encoder: &mut fidl::encoding::Encoder<
2420                '_,
2421                fidl::encoding::DefaultFuchsiaResourceDialect,
2422            >,
2423            offset: usize,
2424            _depth: fidl::encoding::Depth,
2425        ) -> fidl::Result<()> {
2426            encoder.debug_check_bounds::<LauncherLaunchRequest>(offset);
2427            // Delegate to tuple encoding.
2428            fidl::encoding::Encode::<
2429                LauncherLaunchRequest,
2430                fidl::encoding::DefaultFuchsiaResourceDialect,
2431            >::encode(
2432                (<LaunchInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2433                    &mut self.info,
2434                ),),
2435                encoder,
2436                offset,
2437                _depth,
2438            )
2439        }
2440    }
2441    unsafe impl<
2442        T0: fidl::encoding::Encode<LaunchInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
2443    >
2444        fidl::encoding::Encode<LauncherLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2445        for (T0,)
2446    {
2447        #[inline]
2448        unsafe fn encode(
2449            self,
2450            encoder: &mut fidl::encoding::Encoder<
2451                '_,
2452                fidl::encoding::DefaultFuchsiaResourceDialect,
2453            >,
2454            offset: usize,
2455            depth: fidl::encoding::Depth,
2456        ) -> fidl::Result<()> {
2457            encoder.debug_check_bounds::<LauncherLaunchRequest>(offset);
2458            // Zero out padding regions. There's no need to apply masks
2459            // because the unmasked parts will be overwritten by fields.
2460            // Write the fields.
2461            self.0.encode(encoder, offset + 0, depth)?;
2462            Ok(())
2463        }
2464    }
2465
2466    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2467        for LauncherLaunchRequest
2468    {
2469        #[inline(always)]
2470        fn new_empty() -> Self {
2471            Self {
2472                info: fidl::new_empty!(LaunchInfo, fidl::encoding::DefaultFuchsiaResourceDialect),
2473            }
2474        }
2475
2476        #[inline]
2477        unsafe fn decode(
2478            &mut self,
2479            decoder: &mut fidl::encoding::Decoder<
2480                '_,
2481                fidl::encoding::DefaultFuchsiaResourceDialect,
2482            >,
2483            offset: usize,
2484            _depth: fidl::encoding::Depth,
2485        ) -> fidl::Result<()> {
2486            decoder.debug_check_bounds::<Self>(offset);
2487            // Verify that padding bytes are zero.
2488            fidl::decode!(
2489                LaunchInfo,
2490                fidl::encoding::DefaultFuchsiaResourceDialect,
2491                &mut self.info,
2492                decoder,
2493                offset + 0,
2494                _depth
2495            )?;
2496            Ok(())
2497        }
2498    }
2499
2500    impl fidl::encoding::ResourceTypeMarker for LauncherLaunchResponse {
2501        type Borrowed<'a> = &'a mut Self;
2502        fn take_or_borrow<'a>(
2503            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2504        ) -> Self::Borrowed<'a> {
2505            value
2506        }
2507    }
2508
2509    unsafe impl fidl::encoding::TypeMarker for LauncherLaunchResponse {
2510        type Owned = Self;
2511
2512        #[inline(always)]
2513        fn inline_align(_context: fidl::encoding::Context) -> usize {
2514            4
2515        }
2516
2517        #[inline(always)]
2518        fn inline_size(_context: fidl::encoding::Context) -> usize {
2519            8
2520        }
2521    }
2522
2523    unsafe impl
2524        fidl::encoding::Encode<
2525            LauncherLaunchResponse,
2526            fidl::encoding::DefaultFuchsiaResourceDialect,
2527        > for &mut LauncherLaunchResponse
2528    {
2529        #[inline]
2530        unsafe fn encode(
2531            self,
2532            encoder: &mut fidl::encoding::Encoder<
2533                '_,
2534                fidl::encoding::DefaultFuchsiaResourceDialect,
2535            >,
2536            offset: usize,
2537            _depth: fidl::encoding::Depth,
2538        ) -> fidl::Result<()> {
2539            encoder.debug_check_bounds::<LauncherLaunchResponse>(offset);
2540            // Delegate to tuple encoding.
2541            fidl::encoding::Encode::<
2542                LauncherLaunchResponse,
2543                fidl::encoding::DefaultFuchsiaResourceDialect,
2544            >::encode(
2545                (
2546                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2547                    <fidl::encoding::Optional<
2548                        fidl::encoding::HandleType<
2549                            fidl::Process,
2550                            { fidl::ObjectType::PROCESS.into_raw() },
2551                            2147483648,
2552                        >,
2553                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2554                        &mut self.process
2555                    ),
2556                ),
2557                encoder,
2558                offset,
2559                _depth,
2560            )
2561        }
2562    }
2563    unsafe impl<
2564        T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2565        T1: fidl::encoding::Encode<
2566                fidl::encoding::Optional<
2567                    fidl::encoding::HandleType<
2568                        fidl::Process,
2569                        { fidl::ObjectType::PROCESS.into_raw() },
2570                        2147483648,
2571                    >,
2572                >,
2573                fidl::encoding::DefaultFuchsiaResourceDialect,
2574            >,
2575    >
2576        fidl::encoding::Encode<
2577            LauncherLaunchResponse,
2578            fidl::encoding::DefaultFuchsiaResourceDialect,
2579        > for (T0, T1)
2580    {
2581        #[inline]
2582        unsafe fn encode(
2583            self,
2584            encoder: &mut fidl::encoding::Encoder<
2585                '_,
2586                fidl::encoding::DefaultFuchsiaResourceDialect,
2587            >,
2588            offset: usize,
2589            depth: fidl::encoding::Depth,
2590        ) -> fidl::Result<()> {
2591            encoder.debug_check_bounds::<LauncherLaunchResponse>(offset);
2592            // Zero out padding regions. There's no need to apply masks
2593            // because the unmasked parts will be overwritten by fields.
2594            // Write the fields.
2595            self.0.encode(encoder, offset + 0, depth)?;
2596            self.1.encode(encoder, offset + 4, depth)?;
2597            Ok(())
2598        }
2599    }
2600
2601    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2602        for LauncherLaunchResponse
2603    {
2604        #[inline(always)]
2605        fn new_empty() -> Self {
2606            Self {
2607                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
2608                process: fidl::new_empty!(
2609                    fidl::encoding::Optional<
2610                        fidl::encoding::HandleType<
2611                            fidl::Process,
2612                            { fidl::ObjectType::PROCESS.into_raw() },
2613                            2147483648,
2614                        >,
2615                    >,
2616                    fidl::encoding::DefaultFuchsiaResourceDialect
2617                ),
2618            }
2619        }
2620
2621        #[inline]
2622        unsafe fn decode(
2623            &mut self,
2624            decoder: &mut fidl::encoding::Decoder<
2625                '_,
2626                fidl::encoding::DefaultFuchsiaResourceDialect,
2627            >,
2628            offset: usize,
2629            _depth: fidl::encoding::Depth,
2630        ) -> fidl::Result<()> {
2631            decoder.debug_check_bounds::<Self>(offset);
2632            // Verify that padding bytes are zero.
2633            fidl::decode!(
2634                i32,
2635                fidl::encoding::DefaultFuchsiaResourceDialect,
2636                &mut self.status,
2637                decoder,
2638                offset + 0,
2639                _depth
2640            )?;
2641            fidl::decode!(
2642                fidl::encoding::Optional<
2643                    fidl::encoding::HandleType<
2644                        fidl::Process,
2645                        { fidl::ObjectType::PROCESS.into_raw() },
2646                        2147483648,
2647                    >,
2648                >,
2649                fidl::encoding::DefaultFuchsiaResourceDialect,
2650                &mut self.process,
2651                decoder,
2652                offset + 4,
2653                _depth
2654            )?;
2655            Ok(())
2656        }
2657    }
2658
2659    impl fidl::encoding::ResourceTypeMarker for NameInfo {
2660        type Borrowed<'a> = &'a mut Self;
2661        fn take_or_borrow<'a>(
2662            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2663        ) -> Self::Borrowed<'a> {
2664            value
2665        }
2666    }
2667
2668    unsafe impl fidl::encoding::TypeMarker for NameInfo {
2669        type Owned = Self;
2670
2671        #[inline(always)]
2672        fn inline_align(_context: fidl::encoding::Context) -> usize {
2673            8
2674        }
2675
2676        #[inline(always)]
2677        fn inline_size(_context: fidl::encoding::Context) -> usize {
2678            24
2679        }
2680    }
2681
2682    unsafe impl fidl::encoding::Encode<NameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
2683        for &mut NameInfo
2684    {
2685        #[inline]
2686        unsafe fn encode(
2687            self,
2688            encoder: &mut fidl::encoding::Encoder<
2689                '_,
2690                fidl::encoding::DefaultFuchsiaResourceDialect,
2691            >,
2692            offset: usize,
2693            _depth: fidl::encoding::Depth,
2694        ) -> fidl::Result<()> {
2695            encoder.debug_check_bounds::<NameInfo>(offset);
2696            // Delegate to tuple encoding.
2697            fidl::encoding::Encode::<NameInfo, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2698                (
2699                    <fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow(&self.path),
2700                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.directory),
2701                ),
2702                encoder, offset, _depth
2703            )
2704        }
2705    }
2706    unsafe impl<
2707        T0: fidl::encoding::Encode<
2708                fidl::encoding::BoundedString<4095>,
2709                fidl::encoding::DefaultFuchsiaResourceDialect,
2710            >,
2711        T1: fidl::encoding::Encode<
2712                fidl::encoding::Endpoint<
2713                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2714                >,
2715                fidl::encoding::DefaultFuchsiaResourceDialect,
2716            >,
2717    > fidl::encoding::Encode<NameInfo, fidl::encoding::DefaultFuchsiaResourceDialect> for (T0, T1)
2718    {
2719        #[inline]
2720        unsafe fn encode(
2721            self,
2722            encoder: &mut fidl::encoding::Encoder<
2723                '_,
2724                fidl::encoding::DefaultFuchsiaResourceDialect,
2725            >,
2726            offset: usize,
2727            depth: fidl::encoding::Depth,
2728        ) -> fidl::Result<()> {
2729            encoder.debug_check_bounds::<NameInfo>(offset);
2730            // Zero out padding regions. There's no need to apply masks
2731            // because the unmasked parts will be overwritten by fields.
2732            unsafe {
2733                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2734                (ptr as *mut u64).write_unaligned(0);
2735            }
2736            // Write the fields.
2737            self.0.encode(encoder, offset + 0, depth)?;
2738            self.1.encode(encoder, offset + 16, depth)?;
2739            Ok(())
2740        }
2741    }
2742
2743    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for NameInfo {
2744        #[inline(always)]
2745        fn new_empty() -> Self {
2746            Self {
2747                path: fidl::new_empty!(
2748                    fidl::encoding::BoundedString<4095>,
2749                    fidl::encoding::DefaultFuchsiaResourceDialect
2750                ),
2751                directory: fidl::new_empty!(
2752                    fidl::encoding::Endpoint<
2753                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2754                    >,
2755                    fidl::encoding::DefaultFuchsiaResourceDialect
2756                ),
2757            }
2758        }
2759
2760        #[inline]
2761        unsafe fn decode(
2762            &mut self,
2763            decoder: &mut fidl::encoding::Decoder<
2764                '_,
2765                fidl::encoding::DefaultFuchsiaResourceDialect,
2766            >,
2767            offset: usize,
2768            _depth: fidl::encoding::Depth,
2769        ) -> fidl::Result<()> {
2770            decoder.debug_check_bounds::<Self>(offset);
2771            // Verify that padding bytes are zero.
2772            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2773            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2774            let mask = 0xffffffff00000000u64;
2775            let maskedval = padval & mask;
2776            if maskedval != 0 {
2777                return Err(fidl::Error::NonZeroPadding {
2778                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2779                });
2780            }
2781            fidl::decode!(
2782                fidl::encoding::BoundedString<4095>,
2783                fidl::encoding::DefaultFuchsiaResourceDialect,
2784                &mut self.path,
2785                decoder,
2786                offset + 0,
2787                _depth
2788            )?;
2789            fidl::decode!(
2790                fidl::encoding::Endpoint<
2791                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2792                >,
2793                fidl::encoding::DefaultFuchsiaResourceDialect,
2794                &mut self.directory,
2795                decoder,
2796                offset + 16,
2797                _depth
2798            )?;
2799            Ok(())
2800        }
2801    }
2802
2803    impl fidl::encoding::ResourceTypeMarker for ProcessStartData {
2804        type Borrowed<'a> = &'a mut Self;
2805        fn take_or_borrow<'a>(
2806            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2807        ) -> Self::Borrowed<'a> {
2808            value
2809        }
2810    }
2811
2812    unsafe impl fidl::encoding::TypeMarker for ProcessStartData {
2813        type Owned = Self;
2814
2815        #[inline(always)]
2816        fn inline_align(_context: fidl::encoding::Context) -> usize {
2817            8
2818        }
2819
2820        #[inline(always)]
2821        fn inline_size(_context: fidl::encoding::Context) -> usize {
2822            56
2823        }
2824    }
2825
2826    unsafe impl
2827        fidl::encoding::Encode<ProcessStartData, fidl::encoding::DefaultFuchsiaResourceDialect>
2828        for &mut ProcessStartData
2829    {
2830        #[inline]
2831        unsafe fn encode(
2832            self,
2833            encoder: &mut fidl::encoding::Encoder<
2834                '_,
2835                fidl::encoding::DefaultFuchsiaResourceDialect,
2836            >,
2837            offset: usize,
2838            _depth: fidl::encoding::Depth,
2839        ) -> fidl::Result<()> {
2840            encoder.debug_check_bounds::<ProcessStartData>(offset);
2841            // Delegate to tuple encoding.
2842            fidl::encoding::Encode::<ProcessStartData, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2843                (
2844                    <fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.process),
2845                    <fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.root_vmar),
2846                    <fidl::encoding::HandleType<fidl::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.thread),
2847                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.entry),
2848                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.stack),
2849                    <fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.bootstrap),
2850                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.vdso_base),
2851                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.base),
2852                ),
2853                encoder, offset, _depth
2854            )
2855        }
2856    }
2857    unsafe impl<
2858        T0: fidl::encoding::Encode<
2859                fidl::encoding::HandleType<
2860                    fidl::Process,
2861                    { fidl::ObjectType::PROCESS.into_raw() },
2862                    2147483648,
2863                >,
2864                fidl::encoding::DefaultFuchsiaResourceDialect,
2865            >,
2866        T1: fidl::encoding::Encode<
2867                fidl::encoding::HandleType<
2868                    fidl::Vmar,
2869                    { fidl::ObjectType::VMAR.into_raw() },
2870                    2147483648,
2871                >,
2872                fidl::encoding::DefaultFuchsiaResourceDialect,
2873            >,
2874        T2: fidl::encoding::Encode<
2875                fidl::encoding::HandleType<
2876                    fidl::Thread,
2877                    { fidl::ObjectType::THREAD.into_raw() },
2878                    2147483648,
2879                >,
2880                fidl::encoding::DefaultFuchsiaResourceDialect,
2881            >,
2882        T3: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
2883        T4: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
2884        T5: fidl::encoding::Encode<
2885                fidl::encoding::HandleType<
2886                    fidl::Channel,
2887                    { fidl::ObjectType::CHANNEL.into_raw() },
2888                    2147483648,
2889                >,
2890                fidl::encoding::DefaultFuchsiaResourceDialect,
2891            >,
2892        T6: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
2893        T7: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
2894    > fidl::encoding::Encode<ProcessStartData, fidl::encoding::DefaultFuchsiaResourceDialect>
2895        for (T0, T1, T2, T3, T4, T5, T6, T7)
2896    {
2897        #[inline]
2898        unsafe fn encode(
2899            self,
2900            encoder: &mut fidl::encoding::Encoder<
2901                '_,
2902                fidl::encoding::DefaultFuchsiaResourceDialect,
2903            >,
2904            offset: usize,
2905            depth: fidl::encoding::Depth,
2906        ) -> fidl::Result<()> {
2907            encoder.debug_check_bounds::<ProcessStartData>(offset);
2908            // Zero out padding regions. There's no need to apply masks
2909            // because the unmasked parts will be overwritten by fields.
2910            unsafe {
2911                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2912                (ptr as *mut u64).write_unaligned(0);
2913            }
2914            unsafe {
2915                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
2916                (ptr as *mut u64).write_unaligned(0);
2917            }
2918            // Write the fields.
2919            self.0.encode(encoder, offset + 0, depth)?;
2920            self.1.encode(encoder, offset + 4, depth)?;
2921            self.2.encode(encoder, offset + 8, depth)?;
2922            self.3.encode(encoder, offset + 16, depth)?;
2923            self.4.encode(encoder, offset + 24, depth)?;
2924            self.5.encode(encoder, offset + 32, depth)?;
2925            self.6.encode(encoder, offset + 40, depth)?;
2926            self.7.encode(encoder, offset + 48, depth)?;
2927            Ok(())
2928        }
2929    }
2930
2931    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2932        for ProcessStartData
2933    {
2934        #[inline(always)]
2935        fn new_empty() -> Self {
2936            Self {
2937                process: fidl::new_empty!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2938                root_vmar: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2939                thread: fidl::new_empty!(fidl::encoding::HandleType<fidl::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2940                entry: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
2941                stack: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
2942                bootstrap: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2943                vdso_base: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
2944                base: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
2945            }
2946        }
2947
2948        #[inline]
2949        unsafe fn decode(
2950            &mut self,
2951            decoder: &mut fidl::encoding::Decoder<
2952                '_,
2953                fidl::encoding::DefaultFuchsiaResourceDialect,
2954            >,
2955            offset: usize,
2956            _depth: fidl::encoding::Depth,
2957        ) -> fidl::Result<()> {
2958            decoder.debug_check_bounds::<Self>(offset);
2959            // Verify that padding bytes are zero.
2960            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2961            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2962            let mask = 0xffffffff00000000u64;
2963            let maskedval = padval & mask;
2964            if maskedval != 0 {
2965                return Err(fidl::Error::NonZeroPadding {
2966                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2967                });
2968            }
2969            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
2970            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2971            let mask = 0xffffffff00000000u64;
2972            let maskedval = padval & mask;
2973            if maskedval != 0 {
2974                return Err(fidl::Error::NonZeroPadding {
2975                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
2976                });
2977            }
2978            fidl::decode!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.process, decoder, offset + 0, _depth)?;
2979            fidl::decode!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.root_vmar, decoder, offset + 4, _depth)?;
2980            fidl::decode!(fidl::encoding::HandleType<fidl::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.thread, decoder, offset + 8, _depth)?;
2981            fidl::decode!(
2982                u64,
2983                fidl::encoding::DefaultFuchsiaResourceDialect,
2984                &mut self.entry,
2985                decoder,
2986                offset + 16,
2987                _depth
2988            )?;
2989            fidl::decode!(
2990                u64,
2991                fidl::encoding::DefaultFuchsiaResourceDialect,
2992                &mut self.stack,
2993                decoder,
2994                offset + 24,
2995                _depth
2996            )?;
2997            fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.bootstrap, decoder, offset + 32, _depth)?;
2998            fidl::decode!(
2999                u64,
3000                fidl::encoding::DefaultFuchsiaResourceDialect,
3001                &mut self.vdso_base,
3002                decoder,
3003                offset + 40,
3004                _depth
3005            )?;
3006            fidl::decode!(
3007                u64,
3008                fidl::encoding::DefaultFuchsiaResourceDialect,
3009                &mut self.base,
3010                decoder,
3011                offset + 48,
3012                _depth
3013            )?;
3014            Ok(())
3015        }
3016    }
3017
3018    impl fidl::encoding::ResourceTypeMarker for ResolverResolveResponse {
3019        type Borrowed<'a> = &'a mut Self;
3020        fn take_or_borrow<'a>(
3021            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3022        ) -> Self::Borrowed<'a> {
3023            value
3024        }
3025    }
3026
3027    unsafe impl fidl::encoding::TypeMarker for ResolverResolveResponse {
3028        type Owned = Self;
3029
3030        #[inline(always)]
3031        fn inline_align(_context: fidl::encoding::Context) -> usize {
3032            4
3033        }
3034
3035        #[inline(always)]
3036        fn inline_size(_context: fidl::encoding::Context) -> usize {
3037            12
3038        }
3039    }
3040
3041    unsafe impl
3042        fidl::encoding::Encode<
3043            ResolverResolveResponse,
3044            fidl::encoding::DefaultFuchsiaResourceDialect,
3045        > for &mut ResolverResolveResponse
3046    {
3047        #[inline]
3048        unsafe fn encode(
3049            self,
3050            encoder: &mut fidl::encoding::Encoder<
3051                '_,
3052                fidl::encoding::DefaultFuchsiaResourceDialect,
3053            >,
3054            offset: usize,
3055            _depth: fidl::encoding::Depth,
3056        ) -> fidl::Result<()> {
3057            encoder.debug_check_bounds::<ResolverResolveResponse>(offset);
3058            // Delegate to tuple encoding.
3059            fidl::encoding::Encode::<
3060                ResolverResolveResponse,
3061                fidl::encoding::DefaultFuchsiaResourceDialect,
3062            >::encode(
3063                (
3064                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
3065                    <fidl::encoding::Optional<
3066                        fidl::encoding::HandleType<
3067                            fidl::Vmo,
3068                            { fidl::ObjectType::VMO.into_raw() },
3069                            2147483648,
3070                        >,
3071                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3072                        &mut self.executable
3073                    ),
3074                    <fidl::encoding::Optional<
3075                        fidl::encoding::Endpoint<
3076                            fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
3077                        >,
3078                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3079                        &mut self.ldsvc
3080                    ),
3081                ),
3082                encoder,
3083                offset,
3084                _depth,
3085            )
3086        }
3087    }
3088    unsafe impl<
3089        T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
3090        T1: fidl::encoding::Encode<
3091                fidl::encoding::Optional<
3092                    fidl::encoding::HandleType<
3093                        fidl::Vmo,
3094                        { fidl::ObjectType::VMO.into_raw() },
3095                        2147483648,
3096                    >,
3097                >,
3098                fidl::encoding::DefaultFuchsiaResourceDialect,
3099            >,
3100        T2: fidl::encoding::Encode<
3101                fidl::encoding::Optional<
3102                    fidl::encoding::Endpoint<
3103                        fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
3104                    >,
3105                >,
3106                fidl::encoding::DefaultFuchsiaResourceDialect,
3107            >,
3108    >
3109        fidl::encoding::Encode<
3110            ResolverResolveResponse,
3111            fidl::encoding::DefaultFuchsiaResourceDialect,
3112        > for (T0, T1, T2)
3113    {
3114        #[inline]
3115        unsafe fn encode(
3116            self,
3117            encoder: &mut fidl::encoding::Encoder<
3118                '_,
3119                fidl::encoding::DefaultFuchsiaResourceDialect,
3120            >,
3121            offset: usize,
3122            depth: fidl::encoding::Depth,
3123        ) -> fidl::Result<()> {
3124            encoder.debug_check_bounds::<ResolverResolveResponse>(offset);
3125            // Zero out padding regions. There's no need to apply masks
3126            // because the unmasked parts will be overwritten by fields.
3127            // Write the fields.
3128            self.0.encode(encoder, offset + 0, depth)?;
3129            self.1.encode(encoder, offset + 4, depth)?;
3130            self.2.encode(encoder, offset + 8, depth)?;
3131            Ok(())
3132        }
3133    }
3134
3135    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3136        for ResolverResolveResponse
3137    {
3138        #[inline(always)]
3139        fn new_empty() -> Self {
3140            Self {
3141                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
3142                executable: fidl::new_empty!(
3143                    fidl::encoding::Optional<
3144                        fidl::encoding::HandleType<
3145                            fidl::Vmo,
3146                            { fidl::ObjectType::VMO.into_raw() },
3147                            2147483648,
3148                        >,
3149                    >,
3150                    fidl::encoding::DefaultFuchsiaResourceDialect
3151                ),
3152                ldsvc: fidl::new_empty!(
3153                    fidl::encoding::Optional<
3154                        fidl::encoding::Endpoint<
3155                            fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
3156                        >,
3157                    >,
3158                    fidl::encoding::DefaultFuchsiaResourceDialect
3159                ),
3160            }
3161        }
3162
3163        #[inline]
3164        unsafe fn decode(
3165            &mut self,
3166            decoder: &mut fidl::encoding::Decoder<
3167                '_,
3168                fidl::encoding::DefaultFuchsiaResourceDialect,
3169            >,
3170            offset: usize,
3171            _depth: fidl::encoding::Depth,
3172        ) -> fidl::Result<()> {
3173            decoder.debug_check_bounds::<Self>(offset);
3174            // Verify that padding bytes are zero.
3175            fidl::decode!(
3176                i32,
3177                fidl::encoding::DefaultFuchsiaResourceDialect,
3178                &mut self.status,
3179                decoder,
3180                offset + 0,
3181                _depth
3182            )?;
3183            fidl::decode!(
3184                fidl::encoding::Optional<
3185                    fidl::encoding::HandleType<
3186                        fidl::Vmo,
3187                        { fidl::ObjectType::VMO.into_raw() },
3188                        2147483648,
3189                    >,
3190                >,
3191                fidl::encoding::DefaultFuchsiaResourceDialect,
3192                &mut self.executable,
3193                decoder,
3194                offset + 4,
3195                _depth
3196            )?;
3197            fidl::decode!(
3198                fidl::encoding::Optional<
3199                    fidl::encoding::Endpoint<
3200                        fidl::endpoints::ClientEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
3201                    >,
3202                >,
3203                fidl::encoding::DefaultFuchsiaResourceDialect,
3204                &mut self.ldsvc,
3205                decoder,
3206                offset + 8,
3207                _depth
3208            )?;
3209            Ok(())
3210        }
3211    }
3212}