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