Skip to main content

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 LauncherControlHandle {
758    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
759        self.inner.shutdown_with_epitaph(status.into())
760    }
761}
762
763impl fdomain_client::fidl::ControlHandle for LauncherControlHandle {
764    fn shutdown(&self) {
765        self.inner.shutdown()
766    }
767
768    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
769        self.inner.shutdown_with_epitaph(status)
770    }
771
772    fn is_closed(&self) -> bool {
773        self.inner.channel().is_closed()
774    }
775    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
776        self.inner.channel().on_closed()
777    }
778}
779
780impl LauncherControlHandle {}
781
782#[must_use = "FIDL methods require a response to be sent"]
783#[derive(Debug)]
784pub struct LauncherLaunchResponder {
785    control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
786    tx_id: u32,
787}
788
789/// Set the the channel to be shutdown (see [`LauncherControlHandle::shutdown`])
790/// if the responder is dropped without sending a response, so that the client
791/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
792impl std::ops::Drop for LauncherLaunchResponder {
793    fn drop(&mut self) {
794        self.control_handle.shutdown();
795        // Safety: drops once, never accessed again
796        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
797    }
798}
799
800impl fdomain_client::fidl::Responder for LauncherLaunchResponder {
801    type ControlHandle = LauncherControlHandle;
802
803    fn control_handle(&self) -> &LauncherControlHandle {
804        &self.control_handle
805    }
806
807    fn drop_without_shutdown(mut self) {
808        // Safety: drops once, never accessed again due to mem::forget
809        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
810        // Prevent Drop from running (which would shut down the channel)
811        std::mem::forget(self);
812    }
813}
814
815impl LauncherLaunchResponder {
816    /// Sends a response to the FIDL transaction.
817    ///
818    /// Sets the channel to shutdown if an error occurs.
819    pub fn send(
820        self,
821        mut status: i32,
822        mut process: Option<fdomain_client::Process>,
823    ) -> Result<(), fidl::Error> {
824        let _result = self.send_raw(status, process);
825        if _result.is_err() {
826            self.control_handle.shutdown();
827        }
828        self.drop_without_shutdown();
829        _result
830    }
831
832    /// Similar to "send" but does not shutdown the channel if an error occurs.
833    pub fn send_no_shutdown_on_err(
834        self,
835        mut status: i32,
836        mut process: Option<fdomain_client::Process>,
837    ) -> Result<(), fidl::Error> {
838        let _result = self.send_raw(status, process);
839        self.drop_without_shutdown();
840        _result
841    }
842
843    fn send_raw(
844        &self,
845        mut status: i32,
846        mut process: Option<fdomain_client::Process>,
847    ) -> Result<(), fidl::Error> {
848        self.control_handle.inner.send::<LauncherLaunchResponse>(
849            (status, process),
850            self.tx_id,
851            0x11335a9928afbfa4,
852            fidl::encoding::DynamicFlags::empty(),
853        )
854    }
855}
856
857#[must_use = "FIDL methods require a response to be sent"]
858#[derive(Debug)]
859pub struct LauncherCreateWithoutStartingResponder {
860    control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
861    tx_id: u32,
862}
863
864/// Set the the channel to be shutdown (see [`LauncherControlHandle::shutdown`])
865/// if the responder is dropped without sending a response, so that the client
866/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
867impl std::ops::Drop for LauncherCreateWithoutStartingResponder {
868    fn drop(&mut self) {
869        self.control_handle.shutdown();
870        // Safety: drops once, never accessed again
871        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
872    }
873}
874
875impl fdomain_client::fidl::Responder for LauncherCreateWithoutStartingResponder {
876    type ControlHandle = LauncherControlHandle;
877
878    fn control_handle(&self) -> &LauncherControlHandle {
879        &self.control_handle
880    }
881
882    fn drop_without_shutdown(mut self) {
883        // Safety: drops once, never accessed again due to mem::forget
884        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
885        // Prevent Drop from running (which would shut down the channel)
886        std::mem::forget(self);
887    }
888}
889
890impl LauncherCreateWithoutStartingResponder {
891    /// Sends a response to the FIDL transaction.
892    ///
893    /// Sets the channel to shutdown if an error occurs.
894    pub fn send(
895        self,
896        mut status: i32,
897        mut data: Option<ProcessStartData>,
898    ) -> Result<(), fidl::Error> {
899        let _result = self.send_raw(status, data);
900        if _result.is_err() {
901            self.control_handle.shutdown();
902        }
903        self.drop_without_shutdown();
904        _result
905    }
906
907    /// Similar to "send" but does not shutdown the channel if an error occurs.
908    pub fn send_no_shutdown_on_err(
909        self,
910        mut status: i32,
911        mut data: Option<ProcessStartData>,
912    ) -> Result<(), fidl::Error> {
913        let _result = self.send_raw(status, data);
914        self.drop_without_shutdown();
915        _result
916    }
917
918    fn send_raw(
919        &self,
920        mut status: i32,
921        mut data: Option<ProcessStartData>,
922    ) -> Result<(), fidl::Error> {
923        self.control_handle.inner.send::<LauncherCreateWithoutStartingResponse>(
924            (status, data.as_mut()),
925            self.tx_id,
926            0x755f8263fe51cb61,
927            fidl::encoding::DynamicFlags::empty(),
928        )
929    }
930}
931
932#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
933pub struct ResolverMarker;
934
935impl fdomain_client::fidl::ProtocolMarker for ResolverMarker {
936    type Proxy = ResolverProxy;
937    type RequestStream = ResolverRequestStream;
938
939    const DEBUG_NAME: &'static str = "fuchsia.process.Resolver";
940}
941impl fdomain_client::fidl::DiscoverableProtocolMarker for ResolverMarker {}
942
943pub trait ResolverProxyInterface: Send + Sync {
944    type ResolveResponseFut: std::future::Future<
945            Output = Result<
946                (
947                    i32,
948                    Option<fdomain_client::Vmo>,
949                    Option<fdomain_client::fidl::ClientEnd<fdomain_fuchsia_ldsvc::LoaderMarker>>,
950                ),
951                fidl::Error,
952            >,
953        > + Send;
954    fn r#resolve(&self, name: &str) -> Self::ResolveResponseFut;
955}
956
957#[derive(Debug, Clone)]
958pub struct ResolverProxy {
959    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
960}
961
962impl fdomain_client::fidl::Proxy for ResolverProxy {
963    type Protocol = ResolverMarker;
964
965    fn from_channel(inner: fdomain_client::Channel) -> Self {
966        Self::new(inner)
967    }
968
969    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
970        self.client.into_channel().map_err(|client| Self { client })
971    }
972
973    fn as_channel(&self) -> &fdomain_client::Channel {
974        self.client.as_channel()
975    }
976}
977
978impl ResolverProxy {
979    /// Create a new Proxy for fuchsia.process/Resolver.
980    pub fn new(channel: fdomain_client::Channel) -> Self {
981        let protocol_name = <ResolverMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
982        Self { client: fidl::client::Client::new(channel, protocol_name) }
983    }
984
985    /// Get a Stream of events from the remote end of the protocol.
986    ///
987    /// # Panics
988    ///
989    /// Panics if the event stream was already taken.
990    pub fn take_event_stream(&self) -> ResolverEventStream {
991        ResolverEventStream { event_receiver: self.client.take_event_receiver() }
992    }
993
994    /// Resolves the given `name` to an `executable` and an shared library
995    /// loader.
996    ///
997    /// If present, the `executable` is suitable for use as the `executable`
998    /// property of `LaunchInfo` -- in particular, it will have `ZX_RIGHT_EXECUTE`.
999    /// If present, the `ldsvc` is suitable for use as the `PA_LDSVC_LOADER`
1000    /// handle when launching the process.
1001    ///
1002    /// For example, the resolver might locate the given `name` inside a package
1003    /// and return the executable binary from the package as well as a shared
1004    /// library loader scoped to that package.
1005    pub fn r#resolve(
1006        &self,
1007        mut name: &str,
1008    ) -> fidl::client::QueryResponseFut<
1009        (
1010            i32,
1011            Option<fdomain_client::Vmo>,
1012            Option<fdomain_client::fidl::ClientEnd<fdomain_fuchsia_ldsvc::LoaderMarker>>,
1013        ),
1014        fdomain_client::fidl::FDomainResourceDialect,
1015    > {
1016        ResolverProxyInterface::r#resolve(self, name)
1017    }
1018}
1019
1020impl ResolverProxyInterface for ResolverProxy {
1021    type ResolveResponseFut = fidl::client::QueryResponseFut<
1022        (
1023            i32,
1024            Option<fdomain_client::Vmo>,
1025            Option<fdomain_client::fidl::ClientEnd<fdomain_fuchsia_ldsvc::LoaderMarker>>,
1026        ),
1027        fdomain_client::fidl::FDomainResourceDialect,
1028    >;
1029    fn r#resolve(&self, mut name: &str) -> Self::ResolveResponseFut {
1030        fn _decode(
1031            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1032        ) -> Result<
1033            (
1034                i32,
1035                Option<fdomain_client::Vmo>,
1036                Option<fdomain_client::fidl::ClientEnd<fdomain_fuchsia_ldsvc::LoaderMarker>>,
1037            ),
1038            fidl::Error,
1039        > {
1040            let _response = fidl::client::decode_transaction_body::<
1041                ResolverResolveResponse,
1042                fdomain_client::fidl::FDomainResourceDialect,
1043                0x3c15951efde89c90,
1044            >(_buf?)?;
1045            Ok((_response.status, _response.executable, _response.ldsvc))
1046        }
1047        self.client.send_query_and_decode::<ResolverResolveRequest, (
1048            i32,
1049            Option<fdomain_client::Vmo>,
1050            Option<fdomain_client::fidl::ClientEnd<fdomain_fuchsia_ldsvc::LoaderMarker>>,
1051        )>(
1052            (name,), 0x3c15951efde89c90, fidl::encoding::DynamicFlags::empty(), _decode
1053        )
1054    }
1055}
1056
1057pub struct ResolverEventStream {
1058    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1059}
1060
1061impl std::marker::Unpin for ResolverEventStream {}
1062
1063impl futures::stream::FusedStream for ResolverEventStream {
1064    fn is_terminated(&self) -> bool {
1065        self.event_receiver.is_terminated()
1066    }
1067}
1068
1069impl futures::Stream for ResolverEventStream {
1070    type Item = Result<ResolverEvent, fidl::Error>;
1071
1072    fn poll_next(
1073        mut self: std::pin::Pin<&mut Self>,
1074        cx: &mut std::task::Context<'_>,
1075    ) -> std::task::Poll<Option<Self::Item>> {
1076        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1077            &mut self.event_receiver,
1078            cx
1079        )?) {
1080            Some(buf) => std::task::Poll::Ready(Some(ResolverEvent::decode(buf))),
1081            None => std::task::Poll::Ready(None),
1082        }
1083    }
1084}
1085
1086#[derive(Debug)]
1087pub enum ResolverEvent {}
1088
1089impl ResolverEvent {
1090    /// Decodes a message buffer as a [`ResolverEvent`].
1091    fn decode(
1092        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1093    ) -> Result<ResolverEvent, fidl::Error> {
1094        let (bytes, _handles) = buf.split_mut();
1095        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1096        debug_assert_eq!(tx_header.tx_id, 0);
1097        match tx_header.ordinal {
1098            _ => Err(fidl::Error::UnknownOrdinal {
1099                ordinal: tx_header.ordinal,
1100                protocol_name: <ResolverMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1101            }),
1102        }
1103    }
1104}
1105
1106/// A Stream of incoming requests for fuchsia.process/Resolver.
1107pub struct ResolverRequestStream {
1108    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1109    is_terminated: bool,
1110}
1111
1112impl std::marker::Unpin for ResolverRequestStream {}
1113
1114impl futures::stream::FusedStream for ResolverRequestStream {
1115    fn is_terminated(&self) -> bool {
1116        self.is_terminated
1117    }
1118}
1119
1120impl fdomain_client::fidl::RequestStream for ResolverRequestStream {
1121    type Protocol = ResolverMarker;
1122    type ControlHandle = ResolverControlHandle;
1123
1124    fn from_channel(channel: fdomain_client::Channel) -> Self {
1125        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1126    }
1127
1128    fn control_handle(&self) -> Self::ControlHandle {
1129        ResolverControlHandle { inner: self.inner.clone() }
1130    }
1131
1132    fn into_inner(
1133        self,
1134    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1135    {
1136        (self.inner, self.is_terminated)
1137    }
1138
1139    fn from_inner(
1140        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1141        is_terminated: bool,
1142    ) -> Self {
1143        Self { inner, is_terminated }
1144    }
1145}
1146
1147impl futures::Stream for ResolverRequestStream {
1148    type Item = Result<ResolverRequest, fidl::Error>;
1149
1150    fn poll_next(
1151        mut self: std::pin::Pin<&mut Self>,
1152        cx: &mut std::task::Context<'_>,
1153    ) -> std::task::Poll<Option<Self::Item>> {
1154        let this = &mut *self;
1155        if this.inner.check_shutdown(cx) {
1156            this.is_terminated = true;
1157            return std::task::Poll::Ready(None);
1158        }
1159        if this.is_terminated {
1160            panic!("polled ResolverRequestStream after completion");
1161        }
1162        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1163            |bytes, handles| {
1164                match this.inner.channel().read_etc(cx, bytes, handles) {
1165                    std::task::Poll::Ready(Ok(())) => {}
1166                    std::task::Poll::Pending => return std::task::Poll::Pending,
1167                    std::task::Poll::Ready(Err(None)) => {
1168                        this.is_terminated = true;
1169                        return std::task::Poll::Ready(None);
1170                    }
1171                    std::task::Poll::Ready(Err(Some(e))) => {
1172                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1173                            e.into(),
1174                        ))));
1175                    }
1176                }
1177
1178                // A message has been received from the channel
1179                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1180
1181                std::task::Poll::Ready(Some(match header.ordinal {
1182                    0x3c15951efde89c90 => {
1183                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1184                        let mut req = fidl::new_empty!(
1185                            ResolverResolveRequest,
1186                            fdomain_client::fidl::FDomainResourceDialect
1187                        );
1188                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ResolverResolveRequest>(&header, _body_bytes, handles, &mut req)?;
1189                        let control_handle = ResolverControlHandle { inner: this.inner.clone() };
1190                        Ok(ResolverRequest::Resolve {
1191                            name: req.name,
1192
1193                            responder: ResolverResolveResponder {
1194                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1195                                tx_id: header.tx_id,
1196                            },
1197                        })
1198                    }
1199                    _ => Err(fidl::Error::UnknownOrdinal {
1200                        ordinal: header.ordinal,
1201                        protocol_name:
1202                            <ResolverMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1203                    }),
1204                }))
1205            },
1206        )
1207    }
1208}
1209
1210/// An interface for resolving names to executables and library loaders.
1211///
1212/// An executable itself is often not sufficient to create a working process
1213/// because many executables also load shared libraries. On Fuchsia, there is no
1214/// global pool of shared libraries. Instead, every process has an associated
1215/// `fuchsia.ldsvc.Loader`, which provides access to a private pool of shared
1216/// libraries appropriate for that process.
1217///
1218/// This interface provides a protocol for resolving a name into both the
1219/// `zx.Handle:VMO` for the executable and the `fuchsia.ldsvc.Loader` for its
1220/// associated shared libraries.
1221///
1222/// This interface is rarely used directly. Instead, `fdio_spawn` and
1223/// `fdio_spawn_etc` use this interface internally when they try to run a file
1224/// with a `#!resolve` directive.
1225#[derive(Debug)]
1226pub enum ResolverRequest {
1227    /// Resolves the given `name` to an `executable` and an shared library
1228    /// loader.
1229    ///
1230    /// If present, the `executable` is suitable for use as the `executable`
1231    /// property of `LaunchInfo` -- in particular, it will have `ZX_RIGHT_EXECUTE`.
1232    /// If present, the `ldsvc` is suitable for use as the `PA_LDSVC_LOADER`
1233    /// handle when launching the process.
1234    ///
1235    /// For example, the resolver might locate the given `name` inside a package
1236    /// and return the executable binary from the package as well as a shared
1237    /// library loader scoped to that package.
1238    Resolve { name: String, responder: ResolverResolveResponder },
1239}
1240
1241impl ResolverRequest {
1242    #[allow(irrefutable_let_patterns)]
1243    pub fn into_resolve(self) -> Option<(String, ResolverResolveResponder)> {
1244        if let ResolverRequest::Resolve { name, responder } = self {
1245            Some((name, responder))
1246        } else {
1247            None
1248        }
1249    }
1250
1251    /// Name of the method defined in FIDL
1252    pub fn method_name(&self) -> &'static str {
1253        match *self {
1254            ResolverRequest::Resolve { .. } => "resolve",
1255        }
1256    }
1257}
1258
1259#[derive(Debug, Clone)]
1260pub struct ResolverControlHandle {
1261    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1262}
1263
1264impl ResolverControlHandle {
1265    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1266        self.inner.shutdown_with_epitaph(status.into())
1267    }
1268}
1269
1270impl fdomain_client::fidl::ControlHandle for ResolverControlHandle {
1271    fn shutdown(&self) {
1272        self.inner.shutdown()
1273    }
1274
1275    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1276        self.inner.shutdown_with_epitaph(status)
1277    }
1278
1279    fn is_closed(&self) -> bool {
1280        self.inner.channel().is_closed()
1281    }
1282    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1283        self.inner.channel().on_closed()
1284    }
1285}
1286
1287impl ResolverControlHandle {}
1288
1289#[must_use = "FIDL methods require a response to be sent"]
1290#[derive(Debug)]
1291pub struct ResolverResolveResponder {
1292    control_handle: std::mem::ManuallyDrop<ResolverControlHandle>,
1293    tx_id: u32,
1294}
1295
1296/// Set the the channel to be shutdown (see [`ResolverControlHandle::shutdown`])
1297/// if the responder is dropped without sending a response, so that the client
1298/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1299impl std::ops::Drop for ResolverResolveResponder {
1300    fn drop(&mut self) {
1301        self.control_handle.shutdown();
1302        // Safety: drops once, never accessed again
1303        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1304    }
1305}
1306
1307impl fdomain_client::fidl::Responder for ResolverResolveResponder {
1308    type ControlHandle = ResolverControlHandle;
1309
1310    fn control_handle(&self) -> &ResolverControlHandle {
1311        &self.control_handle
1312    }
1313
1314    fn drop_without_shutdown(mut self) {
1315        // Safety: drops once, never accessed again due to mem::forget
1316        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1317        // Prevent Drop from running (which would shut down the channel)
1318        std::mem::forget(self);
1319    }
1320}
1321
1322impl ResolverResolveResponder {
1323    /// Sends a response to the FIDL transaction.
1324    ///
1325    /// Sets the channel to shutdown if an error occurs.
1326    pub fn send(
1327        self,
1328        mut status: i32,
1329        mut executable: Option<fdomain_client::Vmo>,
1330        mut ldsvc: Option<fdomain_client::fidl::ClientEnd<fdomain_fuchsia_ldsvc::LoaderMarker>>,
1331    ) -> Result<(), fidl::Error> {
1332        let _result = self.send_raw(status, executable, ldsvc);
1333        if _result.is_err() {
1334            self.control_handle.shutdown();
1335        }
1336        self.drop_without_shutdown();
1337        _result
1338    }
1339
1340    /// Similar to "send" but does not shutdown the channel if an error occurs.
1341    pub fn send_no_shutdown_on_err(
1342        self,
1343        mut status: i32,
1344        mut executable: Option<fdomain_client::Vmo>,
1345        mut ldsvc: Option<fdomain_client::fidl::ClientEnd<fdomain_fuchsia_ldsvc::LoaderMarker>>,
1346    ) -> Result<(), fidl::Error> {
1347        let _result = self.send_raw(status, executable, ldsvc);
1348        self.drop_without_shutdown();
1349        _result
1350    }
1351
1352    fn send_raw(
1353        &self,
1354        mut status: i32,
1355        mut executable: Option<fdomain_client::Vmo>,
1356        mut ldsvc: Option<fdomain_client::fidl::ClientEnd<fdomain_fuchsia_ldsvc::LoaderMarker>>,
1357    ) -> Result<(), fidl::Error> {
1358        self.control_handle.inner.send::<ResolverResolveResponse>(
1359            (status, executable, ldsvc),
1360            self.tx_id,
1361            0x3c15951efde89c90,
1362            fidl::encoding::DynamicFlags::empty(),
1363        )
1364    }
1365}
1366
1367mod internal {
1368    use super::*;
1369
1370    impl fidl::encoding::ResourceTypeMarker for HandleInfo {
1371        type Borrowed<'a> = &'a mut Self;
1372        fn take_or_borrow<'a>(
1373            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1374        ) -> Self::Borrowed<'a> {
1375            value
1376        }
1377    }
1378
1379    unsafe impl fidl::encoding::TypeMarker for HandleInfo {
1380        type Owned = Self;
1381
1382        #[inline(always)]
1383        fn inline_align(_context: fidl::encoding::Context) -> usize {
1384            4
1385        }
1386
1387        #[inline(always)]
1388        fn inline_size(_context: fidl::encoding::Context) -> usize {
1389            8
1390        }
1391    }
1392
1393    unsafe impl fidl::encoding::Encode<HandleInfo, fdomain_client::fidl::FDomainResourceDialect>
1394        for &mut HandleInfo
1395    {
1396        #[inline]
1397        unsafe fn encode(
1398            self,
1399            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1400            offset: usize,
1401            _depth: fidl::encoding::Depth,
1402        ) -> fidl::Result<()> {
1403            encoder.debug_check_bounds::<HandleInfo>(offset);
1404            // Delegate to tuple encoding.
1405            fidl::encoding::Encode::<HandleInfo, fdomain_client::fidl::FDomainResourceDialect>::encode(
1406                (
1407                    <fidl::encoding::HandleType<fdomain_client::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
1408                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1409                ),
1410                encoder, offset, _depth
1411            )
1412        }
1413    }
1414    unsafe impl<
1415        T0: fidl::encoding::Encode<
1416                fidl::encoding::HandleType<
1417                    fdomain_client::NullableHandle,
1418                    { fidl::ObjectType::NONE.into_raw() },
1419                    2147483648,
1420                >,
1421                fdomain_client::fidl::FDomainResourceDialect,
1422            >,
1423        T1: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
1424    > fidl::encoding::Encode<HandleInfo, fdomain_client::fidl::FDomainResourceDialect>
1425        for (T0, T1)
1426    {
1427        #[inline]
1428        unsafe fn encode(
1429            self,
1430            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1431            offset: usize,
1432            depth: fidl::encoding::Depth,
1433        ) -> fidl::Result<()> {
1434            encoder.debug_check_bounds::<HandleInfo>(offset);
1435            // Zero out padding regions. There's no need to apply masks
1436            // because the unmasked parts will be overwritten by fields.
1437            // Write the fields.
1438            self.0.encode(encoder, offset + 0, depth)?;
1439            self.1.encode(encoder, offset + 4, depth)?;
1440            Ok(())
1441        }
1442    }
1443
1444    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for HandleInfo {
1445        #[inline(always)]
1446        fn new_empty() -> Self {
1447            Self {
1448                handle: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
1449                id: fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect),
1450            }
1451        }
1452
1453        #[inline]
1454        unsafe fn decode(
1455            &mut self,
1456            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1457            offset: usize,
1458            _depth: fidl::encoding::Depth,
1459        ) -> fidl::Result<()> {
1460            decoder.debug_check_bounds::<Self>(offset);
1461            // Verify that padding bytes are zero.
1462            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)?;
1463            fidl::decode!(
1464                u32,
1465                fdomain_client::fidl::FDomainResourceDialect,
1466                &mut self.id,
1467                decoder,
1468                offset + 4,
1469                _depth
1470            )?;
1471            Ok(())
1472        }
1473    }
1474
1475    impl fidl::encoding::ResourceTypeMarker for LaunchInfo {
1476        type Borrowed<'a> = &'a mut Self;
1477        fn take_or_borrow<'a>(
1478            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1479        ) -> Self::Borrowed<'a> {
1480            value
1481        }
1482    }
1483
1484    unsafe impl fidl::encoding::TypeMarker for LaunchInfo {
1485        type Owned = Self;
1486
1487        #[inline(always)]
1488        fn inline_align(_context: fidl::encoding::Context) -> usize {
1489            8
1490        }
1491
1492        #[inline(always)]
1493        fn inline_size(_context: fidl::encoding::Context) -> usize {
1494            24
1495        }
1496    }
1497
1498    unsafe impl fidl::encoding::Encode<LaunchInfo, fdomain_client::fidl::FDomainResourceDialect>
1499        for &mut LaunchInfo
1500    {
1501        #[inline]
1502        unsafe fn encode(
1503            self,
1504            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1505            offset: usize,
1506            _depth: fidl::encoding::Depth,
1507        ) -> fidl::Result<()> {
1508            encoder.debug_check_bounds::<LaunchInfo>(offset);
1509            // Delegate to tuple encoding.
1510            fidl::encoding::Encode::<LaunchInfo, fdomain_client::fidl::FDomainResourceDialect>::encode(
1511                (
1512                    <fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.executable),
1513                    <fidl::encoding::HandleType<fdomain_client::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.job),
1514                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
1515                ),
1516                encoder, offset, _depth
1517            )
1518        }
1519    }
1520    unsafe impl<
1521        T0: fidl::encoding::Encode<
1522                fidl::encoding::HandleType<
1523                    fdomain_client::Vmo,
1524                    { fidl::ObjectType::VMO.into_raw() },
1525                    2147483648,
1526                >,
1527                fdomain_client::fidl::FDomainResourceDialect,
1528            >,
1529        T1: fidl::encoding::Encode<
1530                fidl::encoding::HandleType<
1531                    fdomain_client::Job,
1532                    { fidl::ObjectType::JOB.into_raw() },
1533                    2147483648,
1534                >,
1535                fdomain_client::fidl::FDomainResourceDialect,
1536            >,
1537        T2: fidl::encoding::Encode<
1538                fidl::encoding::BoundedString<32>,
1539                fdomain_client::fidl::FDomainResourceDialect,
1540            >,
1541    > fidl::encoding::Encode<LaunchInfo, fdomain_client::fidl::FDomainResourceDialect>
1542        for (T0, T1, T2)
1543    {
1544        #[inline]
1545        unsafe fn encode(
1546            self,
1547            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1548            offset: usize,
1549            depth: fidl::encoding::Depth,
1550        ) -> fidl::Result<()> {
1551            encoder.debug_check_bounds::<LaunchInfo>(offset);
1552            // Zero out padding regions. There's no need to apply masks
1553            // because the unmasked parts will be overwritten by fields.
1554            // Write the fields.
1555            self.0.encode(encoder, offset + 0, depth)?;
1556            self.1.encode(encoder, offset + 4, depth)?;
1557            self.2.encode(encoder, offset + 8, depth)?;
1558            Ok(())
1559        }
1560    }
1561
1562    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for LaunchInfo {
1563        #[inline(always)]
1564        fn new_empty() -> Self {
1565            Self {
1566                executable: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
1567                job: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
1568                name: fidl::new_empty!(
1569                    fidl::encoding::BoundedString<32>,
1570                    fdomain_client::fidl::FDomainResourceDialect
1571                ),
1572            }
1573        }
1574
1575        #[inline]
1576        unsafe fn decode(
1577            &mut self,
1578            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1579            offset: usize,
1580            _depth: fidl::encoding::Depth,
1581        ) -> fidl::Result<()> {
1582            decoder.debug_check_bounds::<Self>(offset);
1583            // Verify that padding bytes are zero.
1584            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)?;
1585            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)?;
1586            fidl::decode!(
1587                fidl::encoding::BoundedString<32>,
1588                fdomain_client::fidl::FDomainResourceDialect,
1589                &mut self.name,
1590                decoder,
1591                offset + 8,
1592                _depth
1593            )?;
1594            Ok(())
1595        }
1596    }
1597
1598    impl fidl::encoding::ResourceTypeMarker for LauncherAddHandlesRequest {
1599        type Borrowed<'a> = &'a mut Self;
1600        fn take_or_borrow<'a>(
1601            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1602        ) -> Self::Borrowed<'a> {
1603            value
1604        }
1605    }
1606
1607    unsafe impl fidl::encoding::TypeMarker for LauncherAddHandlesRequest {
1608        type Owned = Self;
1609
1610        #[inline(always)]
1611        fn inline_align(_context: fidl::encoding::Context) -> usize {
1612            8
1613        }
1614
1615        #[inline(always)]
1616        fn inline_size(_context: fidl::encoding::Context) -> usize {
1617            16
1618        }
1619    }
1620
1621    unsafe impl
1622        fidl::encoding::Encode<
1623            LauncherAddHandlesRequest,
1624            fdomain_client::fidl::FDomainResourceDialect,
1625        > for &mut LauncherAddHandlesRequest
1626    {
1627        #[inline]
1628        unsafe fn encode(
1629            self,
1630            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1631            offset: usize,
1632            _depth: fidl::encoding::Depth,
1633        ) -> fidl::Result<()> {
1634            encoder.debug_check_bounds::<LauncherAddHandlesRequest>(offset);
1635            // Delegate to tuple encoding.
1636            fidl::encoding::Encode::<LauncherAddHandlesRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
1637                (
1638                    <fidl::encoding::UnboundedVector<HandleInfo> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handles),
1639                ),
1640                encoder, offset, _depth
1641            )
1642        }
1643    }
1644    unsafe impl<
1645        T0: fidl::encoding::Encode<
1646                fidl::encoding::UnboundedVector<HandleInfo>,
1647                fdomain_client::fidl::FDomainResourceDialect,
1648            >,
1649    >
1650        fidl::encoding::Encode<
1651            LauncherAddHandlesRequest,
1652            fdomain_client::fidl::FDomainResourceDialect,
1653        > for (T0,)
1654    {
1655        #[inline]
1656        unsafe fn encode(
1657            self,
1658            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1659            offset: usize,
1660            depth: fidl::encoding::Depth,
1661        ) -> fidl::Result<()> {
1662            encoder.debug_check_bounds::<LauncherAddHandlesRequest>(offset);
1663            // Zero out padding regions. There's no need to apply masks
1664            // because the unmasked parts will be overwritten by fields.
1665            // Write the fields.
1666            self.0.encode(encoder, offset + 0, depth)?;
1667            Ok(())
1668        }
1669    }
1670
1671    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1672        for LauncherAddHandlesRequest
1673    {
1674        #[inline(always)]
1675        fn new_empty() -> Self {
1676            Self {
1677                handles: fidl::new_empty!(
1678                    fidl::encoding::UnboundedVector<HandleInfo>,
1679                    fdomain_client::fidl::FDomainResourceDialect
1680                ),
1681            }
1682        }
1683
1684        #[inline]
1685        unsafe fn decode(
1686            &mut self,
1687            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1688            offset: usize,
1689            _depth: fidl::encoding::Depth,
1690        ) -> fidl::Result<()> {
1691            decoder.debug_check_bounds::<Self>(offset);
1692            // Verify that padding bytes are zero.
1693            fidl::decode!(
1694                fidl::encoding::UnboundedVector<HandleInfo>,
1695                fdomain_client::fidl::FDomainResourceDialect,
1696                &mut self.handles,
1697                decoder,
1698                offset + 0,
1699                _depth
1700            )?;
1701            Ok(())
1702        }
1703    }
1704
1705    impl fidl::encoding::ResourceTypeMarker for LauncherAddNamesRequest {
1706        type Borrowed<'a> = &'a mut Self;
1707        fn take_or_borrow<'a>(
1708            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1709        ) -> Self::Borrowed<'a> {
1710            value
1711        }
1712    }
1713
1714    unsafe impl fidl::encoding::TypeMarker for LauncherAddNamesRequest {
1715        type Owned = Self;
1716
1717        #[inline(always)]
1718        fn inline_align(_context: fidl::encoding::Context) -> usize {
1719            8
1720        }
1721
1722        #[inline(always)]
1723        fn inline_size(_context: fidl::encoding::Context) -> usize {
1724            16
1725        }
1726    }
1727
1728    unsafe impl
1729        fidl::encoding::Encode<
1730            LauncherAddNamesRequest,
1731            fdomain_client::fidl::FDomainResourceDialect,
1732        > for &mut LauncherAddNamesRequest
1733    {
1734        #[inline]
1735        unsafe fn encode(
1736            self,
1737            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1738            offset: usize,
1739            _depth: fidl::encoding::Depth,
1740        ) -> fidl::Result<()> {
1741            encoder.debug_check_bounds::<LauncherAddNamesRequest>(offset);
1742            // Delegate to tuple encoding.
1743            fidl::encoding::Encode::<LauncherAddNamesRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
1744                (
1745                    <fidl::encoding::UnboundedVector<NameInfo> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.names),
1746                ),
1747                encoder, offset, _depth
1748            )
1749        }
1750    }
1751    unsafe impl<
1752        T0: fidl::encoding::Encode<
1753                fidl::encoding::UnboundedVector<NameInfo>,
1754                fdomain_client::fidl::FDomainResourceDialect,
1755            >,
1756    >
1757        fidl::encoding::Encode<
1758            LauncherAddNamesRequest,
1759            fdomain_client::fidl::FDomainResourceDialect,
1760        > for (T0,)
1761    {
1762        #[inline]
1763        unsafe fn encode(
1764            self,
1765            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1766            offset: usize,
1767            depth: fidl::encoding::Depth,
1768        ) -> fidl::Result<()> {
1769            encoder.debug_check_bounds::<LauncherAddNamesRequest>(offset);
1770            // Zero out padding regions. There's no need to apply masks
1771            // because the unmasked parts will be overwritten by fields.
1772            // Write the fields.
1773            self.0.encode(encoder, offset + 0, depth)?;
1774            Ok(())
1775        }
1776    }
1777
1778    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1779        for LauncherAddNamesRequest
1780    {
1781        #[inline(always)]
1782        fn new_empty() -> Self {
1783            Self {
1784                names: fidl::new_empty!(
1785                    fidl::encoding::UnboundedVector<NameInfo>,
1786                    fdomain_client::fidl::FDomainResourceDialect
1787                ),
1788            }
1789        }
1790
1791        #[inline]
1792        unsafe fn decode(
1793            &mut self,
1794            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1795            offset: usize,
1796            _depth: fidl::encoding::Depth,
1797        ) -> fidl::Result<()> {
1798            decoder.debug_check_bounds::<Self>(offset);
1799            // Verify that padding bytes are zero.
1800            fidl::decode!(
1801                fidl::encoding::UnboundedVector<NameInfo>,
1802                fdomain_client::fidl::FDomainResourceDialect,
1803                &mut self.names,
1804                decoder,
1805                offset + 0,
1806                _depth
1807            )?;
1808            Ok(())
1809        }
1810    }
1811
1812    impl fidl::encoding::ResourceTypeMarker for LauncherCreateWithoutStartingRequest {
1813        type Borrowed<'a> = &'a mut Self;
1814        fn take_or_borrow<'a>(
1815            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1816        ) -> Self::Borrowed<'a> {
1817            value
1818        }
1819    }
1820
1821    unsafe impl fidl::encoding::TypeMarker for LauncherCreateWithoutStartingRequest {
1822        type Owned = Self;
1823
1824        #[inline(always)]
1825        fn inline_align(_context: fidl::encoding::Context) -> usize {
1826            8
1827        }
1828
1829        #[inline(always)]
1830        fn inline_size(_context: fidl::encoding::Context) -> usize {
1831            24
1832        }
1833    }
1834
1835    unsafe impl
1836        fidl::encoding::Encode<
1837            LauncherCreateWithoutStartingRequest,
1838            fdomain_client::fidl::FDomainResourceDialect,
1839        > for &mut LauncherCreateWithoutStartingRequest
1840    {
1841        #[inline]
1842        unsafe fn encode(
1843            self,
1844            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1845            offset: usize,
1846            _depth: fidl::encoding::Depth,
1847        ) -> fidl::Result<()> {
1848            encoder.debug_check_bounds::<LauncherCreateWithoutStartingRequest>(offset);
1849            // Delegate to tuple encoding.
1850            fidl::encoding::Encode::<
1851                LauncherCreateWithoutStartingRequest,
1852                fdomain_client::fidl::FDomainResourceDialect,
1853            >::encode(
1854                (<LaunchInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1855                    &mut self.info,
1856                ),),
1857                encoder,
1858                offset,
1859                _depth,
1860            )
1861        }
1862    }
1863    unsafe impl<
1864        T0: fidl::encoding::Encode<LaunchInfo, fdomain_client::fidl::FDomainResourceDialect>,
1865    >
1866        fidl::encoding::Encode<
1867            LauncherCreateWithoutStartingRequest,
1868            fdomain_client::fidl::FDomainResourceDialect,
1869        > for (T0,)
1870    {
1871        #[inline]
1872        unsafe fn encode(
1873            self,
1874            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1875            offset: usize,
1876            depth: fidl::encoding::Depth,
1877        ) -> fidl::Result<()> {
1878            encoder.debug_check_bounds::<LauncherCreateWithoutStartingRequest>(offset);
1879            // Zero out padding regions. There's no need to apply masks
1880            // because the unmasked parts will be overwritten by fields.
1881            // Write the fields.
1882            self.0.encode(encoder, offset + 0, depth)?;
1883            Ok(())
1884        }
1885    }
1886
1887    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1888        for LauncherCreateWithoutStartingRequest
1889    {
1890        #[inline(always)]
1891        fn new_empty() -> Self {
1892            Self {
1893                info: fidl::new_empty!(LaunchInfo, fdomain_client::fidl::FDomainResourceDialect),
1894            }
1895        }
1896
1897        #[inline]
1898        unsafe fn decode(
1899            &mut self,
1900            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1901            offset: usize,
1902            _depth: fidl::encoding::Depth,
1903        ) -> fidl::Result<()> {
1904            decoder.debug_check_bounds::<Self>(offset);
1905            // Verify that padding bytes are zero.
1906            fidl::decode!(
1907                LaunchInfo,
1908                fdomain_client::fidl::FDomainResourceDialect,
1909                &mut self.info,
1910                decoder,
1911                offset + 0,
1912                _depth
1913            )?;
1914            Ok(())
1915        }
1916    }
1917
1918    impl fidl::encoding::ResourceTypeMarker for LauncherCreateWithoutStartingResponse {
1919        type Borrowed<'a> = &'a mut Self;
1920        fn take_or_borrow<'a>(
1921            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1922        ) -> Self::Borrowed<'a> {
1923            value
1924        }
1925    }
1926
1927    unsafe impl fidl::encoding::TypeMarker for LauncherCreateWithoutStartingResponse {
1928        type Owned = Self;
1929
1930        #[inline(always)]
1931        fn inline_align(_context: fidl::encoding::Context) -> usize {
1932            8
1933        }
1934
1935        #[inline(always)]
1936        fn inline_size(_context: fidl::encoding::Context) -> usize {
1937            16
1938        }
1939    }
1940
1941    unsafe impl
1942        fidl::encoding::Encode<
1943            LauncherCreateWithoutStartingResponse,
1944            fdomain_client::fidl::FDomainResourceDialect,
1945        > for &mut LauncherCreateWithoutStartingResponse
1946    {
1947        #[inline]
1948        unsafe fn encode(
1949            self,
1950            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1951            offset: usize,
1952            _depth: fidl::encoding::Depth,
1953        ) -> fidl::Result<()> {
1954            encoder.debug_check_bounds::<LauncherCreateWithoutStartingResponse>(offset);
1955            // Delegate to tuple encoding.
1956            fidl::encoding::Encode::<LauncherCreateWithoutStartingResponse, fdomain_client::fidl::FDomainResourceDialect>::encode(
1957                (
1958                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
1959                    <fidl::encoding::Boxed<ProcessStartData> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.data),
1960                ),
1961                encoder, offset, _depth
1962            )
1963        }
1964    }
1965    unsafe impl<
1966        T0: fidl::encoding::Encode<i32, fdomain_client::fidl::FDomainResourceDialect>,
1967        T1: fidl::encoding::Encode<
1968                fidl::encoding::Boxed<ProcessStartData>,
1969                fdomain_client::fidl::FDomainResourceDialect,
1970            >,
1971    >
1972        fidl::encoding::Encode<
1973            LauncherCreateWithoutStartingResponse,
1974            fdomain_client::fidl::FDomainResourceDialect,
1975        > for (T0, T1)
1976    {
1977        #[inline]
1978        unsafe fn encode(
1979            self,
1980            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1981            offset: usize,
1982            depth: fidl::encoding::Depth,
1983        ) -> fidl::Result<()> {
1984            encoder.debug_check_bounds::<LauncherCreateWithoutStartingResponse>(offset);
1985            // Zero out padding regions. There's no need to apply masks
1986            // because the unmasked parts will be overwritten by fields.
1987            unsafe {
1988                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1989                (ptr as *mut u64).write_unaligned(0);
1990            }
1991            // Write the fields.
1992            self.0.encode(encoder, offset + 0, depth)?;
1993            self.1.encode(encoder, offset + 8, depth)?;
1994            Ok(())
1995        }
1996    }
1997
1998    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1999        for LauncherCreateWithoutStartingResponse
2000    {
2001        #[inline(always)]
2002        fn new_empty() -> Self {
2003            Self {
2004                status: fidl::new_empty!(i32, fdomain_client::fidl::FDomainResourceDialect),
2005                data: fidl::new_empty!(
2006                    fidl::encoding::Boxed<ProcessStartData>,
2007                    fdomain_client::fidl::FDomainResourceDialect
2008                ),
2009            }
2010        }
2011
2012        #[inline]
2013        unsafe fn decode(
2014            &mut self,
2015            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2016            offset: usize,
2017            _depth: fidl::encoding::Depth,
2018        ) -> fidl::Result<()> {
2019            decoder.debug_check_bounds::<Self>(offset);
2020            // Verify that padding bytes are zero.
2021            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2022            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2023            let mask = 0xffffffff00000000u64;
2024            let maskedval = padval & mask;
2025            if maskedval != 0 {
2026                return Err(fidl::Error::NonZeroPadding {
2027                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2028                });
2029            }
2030            fidl::decode!(
2031                i32,
2032                fdomain_client::fidl::FDomainResourceDialect,
2033                &mut self.status,
2034                decoder,
2035                offset + 0,
2036                _depth
2037            )?;
2038            fidl::decode!(
2039                fidl::encoding::Boxed<ProcessStartData>,
2040                fdomain_client::fidl::FDomainResourceDialect,
2041                &mut self.data,
2042                decoder,
2043                offset + 8,
2044                _depth
2045            )?;
2046            Ok(())
2047        }
2048    }
2049
2050    impl fidl::encoding::ResourceTypeMarker for LauncherLaunchRequest {
2051        type Borrowed<'a> = &'a mut Self;
2052        fn take_or_borrow<'a>(
2053            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2054        ) -> Self::Borrowed<'a> {
2055            value
2056        }
2057    }
2058
2059    unsafe impl fidl::encoding::TypeMarker for LauncherLaunchRequest {
2060        type Owned = Self;
2061
2062        #[inline(always)]
2063        fn inline_align(_context: fidl::encoding::Context) -> usize {
2064            8
2065        }
2066
2067        #[inline(always)]
2068        fn inline_size(_context: fidl::encoding::Context) -> usize {
2069            24
2070        }
2071    }
2072
2073    unsafe impl
2074        fidl::encoding::Encode<LauncherLaunchRequest, fdomain_client::fidl::FDomainResourceDialect>
2075        for &mut LauncherLaunchRequest
2076    {
2077        #[inline]
2078        unsafe fn encode(
2079            self,
2080            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2081            offset: usize,
2082            _depth: fidl::encoding::Depth,
2083        ) -> fidl::Result<()> {
2084            encoder.debug_check_bounds::<LauncherLaunchRequest>(offset);
2085            // Delegate to tuple encoding.
2086            fidl::encoding::Encode::<
2087                LauncherLaunchRequest,
2088                fdomain_client::fidl::FDomainResourceDialect,
2089            >::encode(
2090                (<LaunchInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2091                    &mut self.info,
2092                ),),
2093                encoder,
2094                offset,
2095                _depth,
2096            )
2097        }
2098    }
2099    unsafe impl<
2100        T0: fidl::encoding::Encode<LaunchInfo, fdomain_client::fidl::FDomainResourceDialect>,
2101    >
2102        fidl::encoding::Encode<LauncherLaunchRequest, fdomain_client::fidl::FDomainResourceDialect>
2103        for (T0,)
2104    {
2105        #[inline]
2106        unsafe fn encode(
2107            self,
2108            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2109            offset: usize,
2110            depth: fidl::encoding::Depth,
2111        ) -> fidl::Result<()> {
2112            encoder.debug_check_bounds::<LauncherLaunchRequest>(offset);
2113            // Zero out padding regions. There's no need to apply masks
2114            // because the unmasked parts will be overwritten by fields.
2115            // Write the fields.
2116            self.0.encode(encoder, offset + 0, depth)?;
2117            Ok(())
2118        }
2119    }
2120
2121    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2122        for LauncherLaunchRequest
2123    {
2124        #[inline(always)]
2125        fn new_empty() -> Self {
2126            Self {
2127                info: fidl::new_empty!(LaunchInfo, fdomain_client::fidl::FDomainResourceDialect),
2128            }
2129        }
2130
2131        #[inline]
2132        unsafe fn decode(
2133            &mut self,
2134            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2135            offset: usize,
2136            _depth: fidl::encoding::Depth,
2137        ) -> fidl::Result<()> {
2138            decoder.debug_check_bounds::<Self>(offset);
2139            // Verify that padding bytes are zero.
2140            fidl::decode!(
2141                LaunchInfo,
2142                fdomain_client::fidl::FDomainResourceDialect,
2143                &mut self.info,
2144                decoder,
2145                offset + 0,
2146                _depth
2147            )?;
2148            Ok(())
2149        }
2150    }
2151
2152    impl fidl::encoding::ResourceTypeMarker for LauncherLaunchResponse {
2153        type Borrowed<'a> = &'a mut Self;
2154        fn take_or_borrow<'a>(
2155            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2156        ) -> Self::Borrowed<'a> {
2157            value
2158        }
2159    }
2160
2161    unsafe impl fidl::encoding::TypeMarker for LauncherLaunchResponse {
2162        type Owned = Self;
2163
2164        #[inline(always)]
2165        fn inline_align(_context: fidl::encoding::Context) -> usize {
2166            4
2167        }
2168
2169        #[inline(always)]
2170        fn inline_size(_context: fidl::encoding::Context) -> usize {
2171            8
2172        }
2173    }
2174
2175    unsafe impl
2176        fidl::encoding::Encode<LauncherLaunchResponse, fdomain_client::fidl::FDomainResourceDialect>
2177        for &mut LauncherLaunchResponse
2178    {
2179        #[inline]
2180        unsafe fn encode(
2181            self,
2182            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2183            offset: usize,
2184            _depth: fidl::encoding::Depth,
2185        ) -> fidl::Result<()> {
2186            encoder.debug_check_bounds::<LauncherLaunchResponse>(offset);
2187            // Delegate to tuple encoding.
2188            fidl::encoding::Encode::<
2189                LauncherLaunchResponse,
2190                fdomain_client::fidl::FDomainResourceDialect,
2191            >::encode(
2192                (
2193                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2194                    <fidl::encoding::Optional<
2195                        fidl::encoding::HandleType<
2196                            fdomain_client::Process,
2197                            { fidl::ObjectType::PROCESS.into_raw() },
2198                            2147483648,
2199                        >,
2200                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2201                        &mut self.process
2202                    ),
2203                ),
2204                encoder,
2205                offset,
2206                _depth,
2207            )
2208        }
2209    }
2210    unsafe impl<
2211        T0: fidl::encoding::Encode<i32, fdomain_client::fidl::FDomainResourceDialect>,
2212        T1: fidl::encoding::Encode<
2213                fidl::encoding::Optional<
2214                    fidl::encoding::HandleType<
2215                        fdomain_client::Process,
2216                        { fidl::ObjectType::PROCESS.into_raw() },
2217                        2147483648,
2218                    >,
2219                >,
2220                fdomain_client::fidl::FDomainResourceDialect,
2221            >,
2222    >
2223        fidl::encoding::Encode<LauncherLaunchResponse, fdomain_client::fidl::FDomainResourceDialect>
2224        for (T0, T1)
2225    {
2226        #[inline]
2227        unsafe fn encode(
2228            self,
2229            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2230            offset: usize,
2231            depth: fidl::encoding::Depth,
2232        ) -> fidl::Result<()> {
2233            encoder.debug_check_bounds::<LauncherLaunchResponse>(offset);
2234            // Zero out padding regions. There's no need to apply masks
2235            // because the unmasked parts will be overwritten by fields.
2236            // Write the fields.
2237            self.0.encode(encoder, offset + 0, depth)?;
2238            self.1.encode(encoder, offset + 4, depth)?;
2239            Ok(())
2240        }
2241    }
2242
2243    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2244        for LauncherLaunchResponse
2245    {
2246        #[inline(always)]
2247        fn new_empty() -> Self {
2248            Self {
2249                status: fidl::new_empty!(i32, fdomain_client::fidl::FDomainResourceDialect),
2250                process: fidl::new_empty!(
2251                    fidl::encoding::Optional<
2252                        fidl::encoding::HandleType<
2253                            fdomain_client::Process,
2254                            { fidl::ObjectType::PROCESS.into_raw() },
2255                            2147483648,
2256                        >,
2257                    >,
2258                    fdomain_client::fidl::FDomainResourceDialect
2259                ),
2260            }
2261        }
2262
2263        #[inline]
2264        unsafe fn decode(
2265            &mut self,
2266            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2267            offset: usize,
2268            _depth: fidl::encoding::Depth,
2269        ) -> fidl::Result<()> {
2270            decoder.debug_check_bounds::<Self>(offset);
2271            // Verify that padding bytes are zero.
2272            fidl::decode!(
2273                i32,
2274                fdomain_client::fidl::FDomainResourceDialect,
2275                &mut self.status,
2276                decoder,
2277                offset + 0,
2278                _depth
2279            )?;
2280            fidl::decode!(
2281                fidl::encoding::Optional<
2282                    fidl::encoding::HandleType<
2283                        fdomain_client::Process,
2284                        { fidl::ObjectType::PROCESS.into_raw() },
2285                        2147483648,
2286                    >,
2287                >,
2288                fdomain_client::fidl::FDomainResourceDialect,
2289                &mut self.process,
2290                decoder,
2291                offset + 4,
2292                _depth
2293            )?;
2294            Ok(())
2295        }
2296    }
2297
2298    impl fidl::encoding::ResourceTypeMarker for NameInfo {
2299        type Borrowed<'a> = &'a mut Self;
2300        fn take_or_borrow<'a>(
2301            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2302        ) -> Self::Borrowed<'a> {
2303            value
2304        }
2305    }
2306
2307    unsafe impl fidl::encoding::TypeMarker for NameInfo {
2308        type Owned = Self;
2309
2310        #[inline(always)]
2311        fn inline_align(_context: fidl::encoding::Context) -> usize {
2312            8
2313        }
2314
2315        #[inline(always)]
2316        fn inline_size(_context: fidl::encoding::Context) -> usize {
2317            24
2318        }
2319    }
2320
2321    unsafe impl fidl::encoding::Encode<NameInfo, fdomain_client::fidl::FDomainResourceDialect>
2322        for &mut NameInfo
2323    {
2324        #[inline]
2325        unsafe fn encode(
2326            self,
2327            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2328            offset: usize,
2329            _depth: fidl::encoding::Depth,
2330        ) -> fidl::Result<()> {
2331            encoder.debug_check_bounds::<NameInfo>(offset);
2332            // Delegate to tuple encoding.
2333            fidl::encoding::Encode::<NameInfo, fdomain_client::fidl::FDomainResourceDialect>::encode(
2334                (
2335                    <fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow(&self.path),
2336                    <fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<fdomain_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.directory),
2337                ),
2338                encoder, offset, _depth
2339            )
2340        }
2341    }
2342    unsafe impl<
2343        T0: fidl::encoding::Encode<
2344                fidl::encoding::BoundedString<4095>,
2345                fdomain_client::fidl::FDomainResourceDialect,
2346            >,
2347        T1: fidl::encoding::Encode<
2348                fidl::encoding::Endpoint<
2349                    fdomain_client::fidl::ClientEnd<fdomain_fuchsia_io::DirectoryMarker>,
2350                >,
2351                fdomain_client::fidl::FDomainResourceDialect,
2352            >,
2353    > fidl::encoding::Encode<NameInfo, fdomain_client::fidl::FDomainResourceDialect> for (T0, T1)
2354    {
2355        #[inline]
2356        unsafe fn encode(
2357            self,
2358            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2359            offset: usize,
2360            depth: fidl::encoding::Depth,
2361        ) -> fidl::Result<()> {
2362            encoder.debug_check_bounds::<NameInfo>(offset);
2363            // Zero out padding regions. There's no need to apply masks
2364            // because the unmasked parts will be overwritten by fields.
2365            unsafe {
2366                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2367                (ptr as *mut u64).write_unaligned(0);
2368            }
2369            // Write the fields.
2370            self.0.encode(encoder, offset + 0, depth)?;
2371            self.1.encode(encoder, offset + 16, depth)?;
2372            Ok(())
2373        }
2374    }
2375
2376    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for NameInfo {
2377        #[inline(always)]
2378        fn new_empty() -> Self {
2379            Self {
2380                path: fidl::new_empty!(
2381                    fidl::encoding::BoundedString<4095>,
2382                    fdomain_client::fidl::FDomainResourceDialect
2383                ),
2384                directory: fidl::new_empty!(
2385                    fidl::encoding::Endpoint<
2386                        fdomain_client::fidl::ClientEnd<fdomain_fuchsia_io::DirectoryMarker>,
2387                    >,
2388                    fdomain_client::fidl::FDomainResourceDialect
2389                ),
2390            }
2391        }
2392
2393        #[inline]
2394        unsafe fn decode(
2395            &mut self,
2396            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2397            offset: usize,
2398            _depth: fidl::encoding::Depth,
2399        ) -> fidl::Result<()> {
2400            decoder.debug_check_bounds::<Self>(offset);
2401            // Verify that padding bytes are zero.
2402            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2403            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2404            let mask = 0xffffffff00000000u64;
2405            let maskedval = padval & mask;
2406            if maskedval != 0 {
2407                return Err(fidl::Error::NonZeroPadding {
2408                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2409                });
2410            }
2411            fidl::decode!(
2412                fidl::encoding::BoundedString<4095>,
2413                fdomain_client::fidl::FDomainResourceDialect,
2414                &mut self.path,
2415                decoder,
2416                offset + 0,
2417                _depth
2418            )?;
2419            fidl::decode!(
2420                fidl::encoding::Endpoint<
2421                    fdomain_client::fidl::ClientEnd<fdomain_fuchsia_io::DirectoryMarker>,
2422                >,
2423                fdomain_client::fidl::FDomainResourceDialect,
2424                &mut self.directory,
2425                decoder,
2426                offset + 16,
2427                _depth
2428            )?;
2429            Ok(())
2430        }
2431    }
2432
2433    impl fidl::encoding::ResourceTypeMarker for ProcessStartData {
2434        type Borrowed<'a> = &'a mut Self;
2435        fn take_or_borrow<'a>(
2436            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2437        ) -> Self::Borrowed<'a> {
2438            value
2439        }
2440    }
2441
2442    unsafe impl fidl::encoding::TypeMarker for ProcessStartData {
2443        type Owned = Self;
2444
2445        #[inline(always)]
2446        fn inline_align(_context: fidl::encoding::Context) -> usize {
2447            8
2448        }
2449
2450        #[inline(always)]
2451        fn inline_size(_context: fidl::encoding::Context) -> usize {
2452            56
2453        }
2454    }
2455
2456    unsafe impl
2457        fidl::encoding::Encode<ProcessStartData, fdomain_client::fidl::FDomainResourceDialect>
2458        for &mut ProcessStartData
2459    {
2460        #[inline]
2461        unsafe fn encode(
2462            self,
2463            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2464            offset: usize,
2465            _depth: fidl::encoding::Depth,
2466        ) -> fidl::Result<()> {
2467            encoder.debug_check_bounds::<ProcessStartData>(offset);
2468            // Delegate to tuple encoding.
2469            fidl::encoding::Encode::<ProcessStartData, fdomain_client::fidl::FDomainResourceDialect>::encode(
2470                (
2471                    <fidl::encoding::HandleType<fdomain_client::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.process),
2472                    <fidl::encoding::HandleType<fdomain_client::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.root_vmar),
2473                    <fidl::encoding::HandleType<fdomain_client::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.thread),
2474                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.entry),
2475                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.stack),
2476                    <fidl::encoding::HandleType<fdomain_client::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.bootstrap),
2477                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.vdso_base),
2478                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.base),
2479                ),
2480                encoder, offset, _depth
2481            )
2482        }
2483    }
2484    unsafe impl<
2485        T0: fidl::encoding::Encode<
2486                fidl::encoding::HandleType<
2487                    fdomain_client::Process,
2488                    { fidl::ObjectType::PROCESS.into_raw() },
2489                    2147483648,
2490                >,
2491                fdomain_client::fidl::FDomainResourceDialect,
2492            >,
2493        T1: fidl::encoding::Encode<
2494                fidl::encoding::HandleType<
2495                    fdomain_client::Vmar,
2496                    { fidl::ObjectType::VMAR.into_raw() },
2497                    2147483648,
2498                >,
2499                fdomain_client::fidl::FDomainResourceDialect,
2500            >,
2501        T2: fidl::encoding::Encode<
2502                fidl::encoding::HandleType<
2503                    fdomain_client::Thread,
2504                    { fidl::ObjectType::THREAD.into_raw() },
2505                    2147483648,
2506                >,
2507                fdomain_client::fidl::FDomainResourceDialect,
2508            >,
2509        T3: fidl::encoding::Encode<u64, fdomain_client::fidl::FDomainResourceDialect>,
2510        T4: fidl::encoding::Encode<u64, fdomain_client::fidl::FDomainResourceDialect>,
2511        T5: fidl::encoding::Encode<
2512                fidl::encoding::HandleType<
2513                    fdomain_client::Channel,
2514                    { fidl::ObjectType::CHANNEL.into_raw() },
2515                    2147483648,
2516                >,
2517                fdomain_client::fidl::FDomainResourceDialect,
2518            >,
2519        T6: fidl::encoding::Encode<u64, fdomain_client::fidl::FDomainResourceDialect>,
2520        T7: fidl::encoding::Encode<u64, fdomain_client::fidl::FDomainResourceDialect>,
2521    > fidl::encoding::Encode<ProcessStartData, fdomain_client::fidl::FDomainResourceDialect>
2522        for (T0, T1, T2, T3, T4, T5, T6, T7)
2523    {
2524        #[inline]
2525        unsafe fn encode(
2526            self,
2527            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2528            offset: usize,
2529            depth: fidl::encoding::Depth,
2530        ) -> fidl::Result<()> {
2531            encoder.debug_check_bounds::<ProcessStartData>(offset);
2532            // Zero out padding regions. There's no need to apply masks
2533            // because the unmasked parts will be overwritten by fields.
2534            unsafe {
2535                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2536                (ptr as *mut u64).write_unaligned(0);
2537            }
2538            unsafe {
2539                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
2540                (ptr as *mut u64).write_unaligned(0);
2541            }
2542            // Write the fields.
2543            self.0.encode(encoder, offset + 0, depth)?;
2544            self.1.encode(encoder, offset + 4, depth)?;
2545            self.2.encode(encoder, offset + 8, depth)?;
2546            self.3.encode(encoder, offset + 16, depth)?;
2547            self.4.encode(encoder, offset + 24, depth)?;
2548            self.5.encode(encoder, offset + 32, depth)?;
2549            self.6.encode(encoder, offset + 40, depth)?;
2550            self.7.encode(encoder, offset + 48, depth)?;
2551            Ok(())
2552        }
2553    }
2554
2555    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2556        for ProcessStartData
2557    {
2558        #[inline(always)]
2559        fn new_empty() -> Self {
2560            Self {
2561                process: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
2562                root_vmar: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
2563                thread: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
2564                entry: fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect),
2565                stack: fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect),
2566                bootstrap: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
2567                vdso_base: fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect),
2568                base: fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect),
2569            }
2570        }
2571
2572        #[inline]
2573        unsafe fn decode(
2574            &mut self,
2575            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2576            offset: usize,
2577            _depth: fidl::encoding::Depth,
2578        ) -> fidl::Result<()> {
2579            decoder.debug_check_bounds::<Self>(offset);
2580            // Verify that padding bytes are zero.
2581            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2582            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2583            let mask = 0xffffffff00000000u64;
2584            let maskedval = padval & mask;
2585            if maskedval != 0 {
2586                return Err(fidl::Error::NonZeroPadding {
2587                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2588                });
2589            }
2590            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
2591            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2592            let mask = 0xffffffff00000000u64;
2593            let maskedval = padval & mask;
2594            if maskedval != 0 {
2595                return Err(fidl::Error::NonZeroPadding {
2596                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
2597                });
2598            }
2599            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)?;
2600            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)?;
2601            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)?;
2602            fidl::decode!(
2603                u64,
2604                fdomain_client::fidl::FDomainResourceDialect,
2605                &mut self.entry,
2606                decoder,
2607                offset + 16,
2608                _depth
2609            )?;
2610            fidl::decode!(
2611                u64,
2612                fdomain_client::fidl::FDomainResourceDialect,
2613                &mut self.stack,
2614                decoder,
2615                offset + 24,
2616                _depth
2617            )?;
2618            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)?;
2619            fidl::decode!(
2620                u64,
2621                fdomain_client::fidl::FDomainResourceDialect,
2622                &mut self.vdso_base,
2623                decoder,
2624                offset + 40,
2625                _depth
2626            )?;
2627            fidl::decode!(
2628                u64,
2629                fdomain_client::fidl::FDomainResourceDialect,
2630                &mut self.base,
2631                decoder,
2632                offset + 48,
2633                _depth
2634            )?;
2635            Ok(())
2636        }
2637    }
2638
2639    impl fidl::encoding::ResourceTypeMarker for ResolverResolveResponse {
2640        type Borrowed<'a> = &'a mut Self;
2641        fn take_or_borrow<'a>(
2642            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2643        ) -> Self::Borrowed<'a> {
2644            value
2645        }
2646    }
2647
2648    unsafe impl fidl::encoding::TypeMarker for ResolverResolveResponse {
2649        type Owned = Self;
2650
2651        #[inline(always)]
2652        fn inline_align(_context: fidl::encoding::Context) -> usize {
2653            4
2654        }
2655
2656        #[inline(always)]
2657        fn inline_size(_context: fidl::encoding::Context) -> usize {
2658            12
2659        }
2660    }
2661
2662    unsafe impl
2663        fidl::encoding::Encode<
2664            ResolverResolveResponse,
2665            fdomain_client::fidl::FDomainResourceDialect,
2666        > for &mut ResolverResolveResponse
2667    {
2668        #[inline]
2669        unsafe fn encode(
2670            self,
2671            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2672            offset: usize,
2673            _depth: fidl::encoding::Depth,
2674        ) -> fidl::Result<()> {
2675            encoder.debug_check_bounds::<ResolverResolveResponse>(offset);
2676            // Delegate to tuple encoding.
2677            fidl::encoding::Encode::<
2678                ResolverResolveResponse,
2679                fdomain_client::fidl::FDomainResourceDialect,
2680            >::encode(
2681                (
2682                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2683                    <fidl::encoding::Optional<
2684                        fidl::encoding::HandleType<
2685                            fdomain_client::Vmo,
2686                            { fidl::ObjectType::VMO.into_raw() },
2687                            2147483648,
2688                        >,
2689                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2690                        &mut self.executable
2691                    ),
2692                    <fidl::encoding::Optional<
2693                        fidl::encoding::Endpoint<
2694                            fdomain_client::fidl::ClientEnd<fdomain_fuchsia_ldsvc::LoaderMarker>,
2695                        >,
2696                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2697                        &mut self.ldsvc
2698                    ),
2699                ),
2700                encoder,
2701                offset,
2702                _depth,
2703            )
2704        }
2705    }
2706    unsafe impl<
2707        T0: fidl::encoding::Encode<i32, fdomain_client::fidl::FDomainResourceDialect>,
2708        T1: fidl::encoding::Encode<
2709                fidl::encoding::Optional<
2710                    fidl::encoding::HandleType<
2711                        fdomain_client::Vmo,
2712                        { fidl::ObjectType::VMO.into_raw() },
2713                        2147483648,
2714                    >,
2715                >,
2716                fdomain_client::fidl::FDomainResourceDialect,
2717            >,
2718        T2: fidl::encoding::Encode<
2719                fidl::encoding::Optional<
2720                    fidl::encoding::Endpoint<
2721                        fdomain_client::fidl::ClientEnd<fdomain_fuchsia_ldsvc::LoaderMarker>,
2722                    >,
2723                >,
2724                fdomain_client::fidl::FDomainResourceDialect,
2725            >,
2726    >
2727        fidl::encoding::Encode<
2728            ResolverResolveResponse,
2729            fdomain_client::fidl::FDomainResourceDialect,
2730        > for (T0, T1, T2)
2731    {
2732        #[inline]
2733        unsafe fn encode(
2734            self,
2735            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2736            offset: usize,
2737            depth: fidl::encoding::Depth,
2738        ) -> fidl::Result<()> {
2739            encoder.debug_check_bounds::<ResolverResolveResponse>(offset);
2740            // Zero out padding regions. There's no need to apply masks
2741            // because the unmasked parts will be overwritten by fields.
2742            // Write the fields.
2743            self.0.encode(encoder, offset + 0, depth)?;
2744            self.1.encode(encoder, offset + 4, depth)?;
2745            self.2.encode(encoder, offset + 8, depth)?;
2746            Ok(())
2747        }
2748    }
2749
2750    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2751        for ResolverResolveResponse
2752    {
2753        #[inline(always)]
2754        fn new_empty() -> Self {
2755            Self {
2756                status: fidl::new_empty!(i32, fdomain_client::fidl::FDomainResourceDialect),
2757                executable: fidl::new_empty!(
2758                    fidl::encoding::Optional<
2759                        fidl::encoding::HandleType<
2760                            fdomain_client::Vmo,
2761                            { fidl::ObjectType::VMO.into_raw() },
2762                            2147483648,
2763                        >,
2764                    >,
2765                    fdomain_client::fidl::FDomainResourceDialect
2766                ),
2767                ldsvc: fidl::new_empty!(
2768                    fidl::encoding::Optional<
2769                        fidl::encoding::Endpoint<
2770                            fdomain_client::fidl::ClientEnd<fdomain_fuchsia_ldsvc::LoaderMarker>,
2771                        >,
2772                    >,
2773                    fdomain_client::fidl::FDomainResourceDialect
2774                ),
2775            }
2776        }
2777
2778        #[inline]
2779        unsafe fn decode(
2780            &mut self,
2781            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2782            offset: usize,
2783            _depth: fidl::encoding::Depth,
2784        ) -> fidl::Result<()> {
2785            decoder.debug_check_bounds::<Self>(offset);
2786            // Verify that padding bytes are zero.
2787            fidl::decode!(
2788                i32,
2789                fdomain_client::fidl::FDomainResourceDialect,
2790                &mut self.status,
2791                decoder,
2792                offset + 0,
2793                _depth
2794            )?;
2795            fidl::decode!(
2796                fidl::encoding::Optional<
2797                    fidl::encoding::HandleType<
2798                        fdomain_client::Vmo,
2799                        { fidl::ObjectType::VMO.into_raw() },
2800                        2147483648,
2801                    >,
2802                >,
2803                fdomain_client::fidl::FDomainResourceDialect,
2804                &mut self.executable,
2805                decoder,
2806                offset + 4,
2807                _depth
2808            )?;
2809            fidl::decode!(
2810                fidl::encoding::Optional<
2811                    fidl::encoding::Endpoint<
2812                        fdomain_client::fidl::ClientEnd<fdomain_fuchsia_ldsvc::LoaderMarker>,
2813                    >,
2814                >,
2815                fdomain_client::fidl::FDomainResourceDialect,
2816                &mut self.ldsvc,
2817                decoder,
2818                offset + 8,
2819                _depth
2820            )?;
2821            Ok(())
2822        }
2823    }
2824}