fidl_fuchsia_process/
fidl_fuchsia_process.rs

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