fidl_fuchsia_process/
fidl_fuchsia_process.rs

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