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