fidl_fuchsia_process/
fidl_fuchsia_process.rs

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