fidl_fuchsia_dash/
fidl_fuchsia_dash.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_dash__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct LauncherExploreComponentOverPtyRequest {
16    /// The moniker of the component that dash should be scoped to
17    pub moniker: String,
18    /// The PTY device that should be forwarded to the dash process
19    pub pty: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
20    /// A list of package URLs whose directories will also be loaded into the dash namespace.
21    /// The path preference is determined by the order of this vector.
22    pub tool_urls: Vec<String>,
23    /// An optional inline command to run
24    pub command: Option<String>,
25    /// The namespace layout to create for the dash process
26    pub ns_layout: DashNamespaceLayout,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30    for LauncherExploreComponentOverPtyRequest
31{
32}
33
34#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
35pub struct LauncherExploreComponentOverSocketRequest {
36    /// The moniker of the component that dash should be scoped to
37    pub moniker: String,
38    /// The raw socket to connect to the dash process
39    pub socket: fidl::Socket,
40    /// A list of package URLs whose directories will also be loaded into the dash namespace.
41    /// The path preference is determined by the order of this vector.
42    pub tool_urls: Vec<String>,
43    /// An optional inline command to run
44    pub command: Option<String>,
45    /// The namespace layout to create for the dash process
46    pub ns_layout: DashNamespaceLayout,
47}
48
49impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
50    for LauncherExploreComponentOverSocketRequest
51{
52}
53
54#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
55pub struct LauncherExplorePackageOverSocket2Request {
56    /// The package resolver to use when resolving package URLs (both `url` and `tool_urls`)
57    /// that have the `fuchsia-pkg` scheme.
58    pub fuchsia_pkg_resolver: FuchsiaPkgResolver,
59    /// The absolute package URL to resolve.
60    /// If `subpackages` is empty the resolved package directory will be loaded into the dash
61    /// namespace at `/pkg`.
62    /// If `subpackages` is not empty, the package directory of the final subpackage of `url`
63    /// will be loaded into the namespace at `/pkg`.
64    pub url: String,
65    /// The chain of subpackages, if any, of `url` to resolve, in resolution order.
66    /// If `subpackages` is not empty, the package directory of the final subpackage will be
67    /// loaded into the dash namespace at `/pkg`.
68    pub subpackages: Vec<String>,
69    /// The raw socket to connect to the dash process
70    pub socket: fidl::Socket,
71    /// A list of package URLs whose directories will also be loaded into the dash namespace.
72    /// The path preference is determined by the order of this vector.
73    pub tool_urls: Vec<String>,
74    /// An optional inline command to run.
75    pub command: Option<String>,
76}
77
78impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
79    for LauncherExplorePackageOverSocket2Request
80{
81}
82
83#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
84pub struct LauncherExplorePackageOverSocketRequest {
85    /// The absolute package URL to resolve.
86    /// If `subpackages` is empty the resolved package directory will be loaded into the dash
87    /// namespace at `/pkg`.
88    /// If `subpackages` is not empty, the package directory of the final subpackage of `url`
89    /// will be loaded into the namespace at `/pkg`.
90    pub url: String,
91    /// The chain of subpackages, if any, of `url` to resolve, in resolution order.
92    /// If `subpackages` is not empty, the package directory of the final subpackage will be
93    /// loaded into the dash namespace at `/pkg`.
94    pub subpackages: Vec<String>,
95    /// The raw socket to connect to the dash process
96    pub socket: fidl::Socket,
97    /// A list of package URLs whose directories will also be loaded into the dash namespace.
98    /// The path preference is determined by the order of this vector.
99    pub tool_urls: Vec<String>,
100    /// An optional inline command to run.
101    pub command: Option<String>,
102}
103
104impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
105    for LauncherExplorePackageOverSocketRequest
106{
107}
108
109#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
110pub struct LauncherMarker;
111
112impl fidl::endpoints::ProtocolMarker for LauncherMarker {
113    type Proxy = LauncherProxy;
114    type RequestStream = LauncherRequestStream;
115    #[cfg(target_os = "fuchsia")]
116    type SynchronousProxy = LauncherSynchronousProxy;
117
118    const DEBUG_NAME: &'static str = "fuchsia.dash.Launcher";
119}
120impl fidl::endpoints::DiscoverableProtocolMarker for LauncherMarker {}
121pub type LauncherExploreComponentOverPtyResult = Result<(), LauncherError>;
122pub type LauncherExploreComponentOverSocketResult = Result<(), LauncherError>;
123pub type LauncherExplorePackageOverSocketResult = Result<(), LauncherError>;
124pub type LauncherExplorePackageOverSocket2Result = Result<(), LauncherError>;
125
126pub trait LauncherProxyInterface: Send + Sync {
127    type ExploreComponentOverPtyResponseFut: std::future::Future<Output = Result<LauncherExploreComponentOverPtyResult, fidl::Error>>
128        + Send;
129    fn r#explore_component_over_pty(
130        &self,
131        moniker: &str,
132        pty: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
133        tool_urls: &[String],
134        command: Option<&str>,
135        ns_layout: DashNamespaceLayout,
136    ) -> Self::ExploreComponentOverPtyResponseFut;
137    type ExploreComponentOverSocketResponseFut: std::future::Future<Output = Result<LauncherExploreComponentOverSocketResult, fidl::Error>>
138        + Send;
139    fn r#explore_component_over_socket(
140        &self,
141        moniker: &str,
142        socket: fidl::Socket,
143        tool_urls: &[String],
144        command: Option<&str>,
145        ns_layout: DashNamespaceLayout,
146    ) -> Self::ExploreComponentOverSocketResponseFut;
147    type ExplorePackageOverSocketResponseFut: std::future::Future<Output = Result<LauncherExplorePackageOverSocketResult, fidl::Error>>
148        + Send;
149    fn r#explore_package_over_socket(
150        &self,
151        url: &str,
152        subpackages: &[String],
153        socket: fidl::Socket,
154        tool_urls: &[String],
155        command: Option<&str>,
156    ) -> Self::ExplorePackageOverSocketResponseFut;
157    type ExplorePackageOverSocket2ResponseFut: std::future::Future<Output = Result<LauncherExplorePackageOverSocket2Result, fidl::Error>>
158        + Send;
159    fn r#explore_package_over_socket2(
160        &self,
161        fuchsia_pkg_resolver: FuchsiaPkgResolver,
162        url: &str,
163        subpackages: &[String],
164        socket: fidl::Socket,
165        tool_urls: &[String],
166        command: Option<&str>,
167    ) -> Self::ExplorePackageOverSocket2ResponseFut;
168}
169#[derive(Debug)]
170#[cfg(target_os = "fuchsia")]
171pub struct LauncherSynchronousProxy {
172    client: fidl::client::sync::Client,
173}
174
175#[cfg(target_os = "fuchsia")]
176impl fidl::endpoints::SynchronousProxy for LauncherSynchronousProxy {
177    type Proxy = LauncherProxy;
178    type Protocol = LauncherMarker;
179
180    fn from_channel(inner: fidl::Channel) -> Self {
181        Self::new(inner)
182    }
183
184    fn into_channel(self) -> fidl::Channel {
185        self.client.into_channel()
186    }
187
188    fn as_channel(&self) -> &fidl::Channel {
189        self.client.as_channel()
190    }
191}
192
193#[cfg(target_os = "fuchsia")]
194impl LauncherSynchronousProxy {
195    pub fn new(channel: fidl::Channel) -> Self {
196        let protocol_name = <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
197        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
198    }
199
200    pub fn into_channel(self) -> fidl::Channel {
201        self.client.into_channel()
202    }
203
204    /// Waits until an event arrives and returns it. It is safe for other
205    /// threads to make concurrent requests while waiting for an event.
206    pub fn wait_for_event(
207        &self,
208        deadline: zx::MonotonicInstant,
209    ) -> Result<LauncherEvent, fidl::Error> {
210        LauncherEvent::decode(self.client.wait_for_event(deadline)?)
211    }
212
213    /// Launch a dash process scoped to the component with the given moniker, forwarding the given
214    /// stdio PTY.
215    pub fn r#explore_component_over_pty(
216        &self,
217        mut moniker: &str,
218        mut pty: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
219        mut tool_urls: &[String],
220        mut command: Option<&str>,
221        mut ns_layout: DashNamespaceLayout,
222        ___deadline: zx::MonotonicInstant,
223    ) -> Result<LauncherExploreComponentOverPtyResult, fidl::Error> {
224        let _response = self.client.send_query::<
225            LauncherExploreComponentOverPtyRequest,
226            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LauncherError>,
227        >(
228            (moniker, pty, tool_urls, command, ns_layout,),
229            0x22efaa9c12b8779f,
230            fidl::encoding::DynamicFlags::empty(),
231            ___deadline,
232        )?;
233        Ok(_response.map(|x| x))
234    }
235
236    /// Launch a dash process scoped to the component with the given moniker, forwarding the given
237    /// stdio socket.
238    ///
239    /// The dash launcher will implicitly create a PTY and transfer bytes between the PTY and
240    /// the socket.
241    pub fn r#explore_component_over_socket(
242        &self,
243        mut moniker: &str,
244        mut socket: fidl::Socket,
245        mut tool_urls: &[String],
246        mut command: Option<&str>,
247        mut ns_layout: DashNamespaceLayout,
248        ___deadline: zx::MonotonicInstant,
249    ) -> Result<LauncherExploreComponentOverSocketResult, fidl::Error> {
250        let _response = self.client.send_query::<
251            LauncherExploreComponentOverSocketRequest,
252            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LauncherError>,
253        >(
254            (moniker, socket, tool_urls, command, ns_layout,),
255            0x233557fb2b70eb68,
256            fidl::encoding::DynamicFlags::empty(),
257            ___deadline,
258        )?;
259        Ok(_response.map(|x| x))
260    }
261
262    /// Launch a dash process with the indicated [sub]package loaded into the namespace at /pkg,
263    /// forwarding the given stdio socket.
264    ///
265    /// The dash launcher will implicitly create a PTY and transfer bytes between the PTY and
266    /// the socket.
267    ///
268    /// Always uses [`fuchsia.dash/FuchsiaPkgResolver.FULL`] to resolve package URLs with scheme
269    /// "fuchsia-pkg".
270    /// Use [`fuchsia.dash/Launcher.ExplorePackageOverSocket2`] instead to pick which resolver to
271    /// use with "fuchsia-pkg" URLs.
272    pub fn r#explore_package_over_socket(
273        &self,
274        mut url: &str,
275        mut subpackages: &[String],
276        mut socket: fidl::Socket,
277        mut tool_urls: &[String],
278        mut command: Option<&str>,
279        ___deadline: zx::MonotonicInstant,
280    ) -> Result<LauncherExplorePackageOverSocketResult, fidl::Error> {
281        let _response = self.client.send_query::<
282            LauncherExplorePackageOverSocketRequest,
283            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LauncherError>,
284        >(
285            (url, subpackages, socket, tool_urls, command,),
286            0x8e536067655b5a2,
287            fidl::encoding::DynamicFlags::empty(),
288            ___deadline,
289        )?;
290        Ok(_response.map(|x| x))
291    }
292
293    /// Launch a dash process with the indicated [sub]package loaded into the namespace at /pkg,
294    /// forwarding the given stdio socket.
295    ///
296    /// The dash launcher will implicitly create a PTY and transfer bytes between the PTY and
297    /// the socket.
298    pub fn r#explore_package_over_socket2(
299        &self,
300        mut fuchsia_pkg_resolver: FuchsiaPkgResolver,
301        mut url: &str,
302        mut subpackages: &[String],
303        mut socket: fidl::Socket,
304        mut tool_urls: &[String],
305        mut command: Option<&str>,
306        ___deadline: zx::MonotonicInstant,
307    ) -> Result<LauncherExplorePackageOverSocket2Result, fidl::Error> {
308        let _response = self.client.send_query::<
309            LauncherExplorePackageOverSocket2Request,
310            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LauncherError>,
311        >(
312            (fuchsia_pkg_resolver, url, subpackages, socket, tool_urls, command,),
313            0x3884e07c1fa8d20b,
314            fidl::encoding::DynamicFlags::empty(),
315            ___deadline,
316        )?;
317        Ok(_response.map(|x| x))
318    }
319}
320
321#[cfg(target_os = "fuchsia")]
322impl From<LauncherSynchronousProxy> for zx::Handle {
323    fn from(value: LauncherSynchronousProxy) -> Self {
324        value.into_channel().into()
325    }
326}
327
328#[cfg(target_os = "fuchsia")]
329impl From<fidl::Channel> for LauncherSynchronousProxy {
330    fn from(value: fidl::Channel) -> Self {
331        Self::new(value)
332    }
333}
334
335#[cfg(target_os = "fuchsia")]
336impl fidl::endpoints::FromClient for LauncherSynchronousProxy {
337    type Protocol = LauncherMarker;
338
339    fn from_client(value: fidl::endpoints::ClientEnd<LauncherMarker>) -> Self {
340        Self::new(value.into_channel())
341    }
342}
343
344#[derive(Debug, Clone)]
345pub struct LauncherProxy {
346    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
347}
348
349impl fidl::endpoints::Proxy for LauncherProxy {
350    type Protocol = LauncherMarker;
351
352    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
353        Self::new(inner)
354    }
355
356    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
357        self.client.into_channel().map_err(|client| Self { client })
358    }
359
360    fn as_channel(&self) -> &::fidl::AsyncChannel {
361        self.client.as_channel()
362    }
363}
364
365impl LauncherProxy {
366    /// Create a new Proxy for fuchsia.dash/Launcher.
367    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
368        let protocol_name = <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
369        Self { client: fidl::client::Client::new(channel, protocol_name) }
370    }
371
372    /// Get a Stream of events from the remote end of the protocol.
373    ///
374    /// # Panics
375    ///
376    /// Panics if the event stream was already taken.
377    pub fn take_event_stream(&self) -> LauncherEventStream {
378        LauncherEventStream { event_receiver: self.client.take_event_receiver() }
379    }
380
381    /// Launch a dash process scoped to the component with the given moniker, forwarding the given
382    /// stdio PTY.
383    pub fn r#explore_component_over_pty(
384        &self,
385        mut moniker: &str,
386        mut pty: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
387        mut tool_urls: &[String],
388        mut command: Option<&str>,
389        mut ns_layout: DashNamespaceLayout,
390    ) -> fidl::client::QueryResponseFut<
391        LauncherExploreComponentOverPtyResult,
392        fidl::encoding::DefaultFuchsiaResourceDialect,
393    > {
394        LauncherProxyInterface::r#explore_component_over_pty(
395            self, moniker, pty, tool_urls, command, ns_layout,
396        )
397    }
398
399    /// Launch a dash process scoped to the component with the given moniker, forwarding the given
400    /// stdio socket.
401    ///
402    /// The dash launcher will implicitly create a PTY and transfer bytes between the PTY and
403    /// the socket.
404    pub fn r#explore_component_over_socket(
405        &self,
406        mut moniker: &str,
407        mut socket: fidl::Socket,
408        mut tool_urls: &[String],
409        mut command: Option<&str>,
410        mut ns_layout: DashNamespaceLayout,
411    ) -> fidl::client::QueryResponseFut<
412        LauncherExploreComponentOverSocketResult,
413        fidl::encoding::DefaultFuchsiaResourceDialect,
414    > {
415        LauncherProxyInterface::r#explore_component_over_socket(
416            self, moniker, socket, tool_urls, command, ns_layout,
417        )
418    }
419
420    /// Launch a dash process with the indicated [sub]package loaded into the namespace at /pkg,
421    /// forwarding the given stdio socket.
422    ///
423    /// The dash launcher will implicitly create a PTY and transfer bytes between the PTY and
424    /// the socket.
425    ///
426    /// Always uses [`fuchsia.dash/FuchsiaPkgResolver.FULL`] to resolve package URLs with scheme
427    /// "fuchsia-pkg".
428    /// Use [`fuchsia.dash/Launcher.ExplorePackageOverSocket2`] instead to pick which resolver to
429    /// use with "fuchsia-pkg" URLs.
430    pub fn r#explore_package_over_socket(
431        &self,
432        mut url: &str,
433        mut subpackages: &[String],
434        mut socket: fidl::Socket,
435        mut tool_urls: &[String],
436        mut command: Option<&str>,
437    ) -> fidl::client::QueryResponseFut<
438        LauncherExplorePackageOverSocketResult,
439        fidl::encoding::DefaultFuchsiaResourceDialect,
440    > {
441        LauncherProxyInterface::r#explore_package_over_socket(
442            self,
443            url,
444            subpackages,
445            socket,
446            tool_urls,
447            command,
448        )
449    }
450
451    /// Launch a dash process with the indicated [sub]package loaded into the namespace at /pkg,
452    /// forwarding the given stdio socket.
453    ///
454    /// The dash launcher will implicitly create a PTY and transfer bytes between the PTY and
455    /// the socket.
456    pub fn r#explore_package_over_socket2(
457        &self,
458        mut fuchsia_pkg_resolver: FuchsiaPkgResolver,
459        mut url: &str,
460        mut subpackages: &[String],
461        mut socket: fidl::Socket,
462        mut tool_urls: &[String],
463        mut command: Option<&str>,
464    ) -> fidl::client::QueryResponseFut<
465        LauncherExplorePackageOverSocket2Result,
466        fidl::encoding::DefaultFuchsiaResourceDialect,
467    > {
468        LauncherProxyInterface::r#explore_package_over_socket2(
469            self,
470            fuchsia_pkg_resolver,
471            url,
472            subpackages,
473            socket,
474            tool_urls,
475            command,
476        )
477    }
478}
479
480impl LauncherProxyInterface for LauncherProxy {
481    type ExploreComponentOverPtyResponseFut = fidl::client::QueryResponseFut<
482        LauncherExploreComponentOverPtyResult,
483        fidl::encoding::DefaultFuchsiaResourceDialect,
484    >;
485    fn r#explore_component_over_pty(
486        &self,
487        mut moniker: &str,
488        mut pty: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
489        mut tool_urls: &[String],
490        mut command: Option<&str>,
491        mut ns_layout: DashNamespaceLayout,
492    ) -> Self::ExploreComponentOverPtyResponseFut {
493        fn _decode(
494            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
495        ) -> Result<LauncherExploreComponentOverPtyResult, fidl::Error> {
496            let _response = fidl::client::decode_transaction_body::<
497                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LauncherError>,
498                fidl::encoding::DefaultFuchsiaResourceDialect,
499                0x22efaa9c12b8779f,
500            >(_buf?)?;
501            Ok(_response.map(|x| x))
502        }
503        self.client.send_query_and_decode::<
504            LauncherExploreComponentOverPtyRequest,
505            LauncherExploreComponentOverPtyResult,
506        >(
507            (moniker, pty, tool_urls, command, ns_layout,),
508            0x22efaa9c12b8779f,
509            fidl::encoding::DynamicFlags::empty(),
510            _decode,
511        )
512    }
513
514    type ExploreComponentOverSocketResponseFut = fidl::client::QueryResponseFut<
515        LauncherExploreComponentOverSocketResult,
516        fidl::encoding::DefaultFuchsiaResourceDialect,
517    >;
518    fn r#explore_component_over_socket(
519        &self,
520        mut moniker: &str,
521        mut socket: fidl::Socket,
522        mut tool_urls: &[String],
523        mut command: Option<&str>,
524        mut ns_layout: DashNamespaceLayout,
525    ) -> Self::ExploreComponentOverSocketResponseFut {
526        fn _decode(
527            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
528        ) -> Result<LauncherExploreComponentOverSocketResult, fidl::Error> {
529            let _response = fidl::client::decode_transaction_body::<
530                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LauncherError>,
531                fidl::encoding::DefaultFuchsiaResourceDialect,
532                0x233557fb2b70eb68,
533            >(_buf?)?;
534            Ok(_response.map(|x| x))
535        }
536        self.client.send_query_and_decode::<
537            LauncherExploreComponentOverSocketRequest,
538            LauncherExploreComponentOverSocketResult,
539        >(
540            (moniker, socket, tool_urls, command, ns_layout,),
541            0x233557fb2b70eb68,
542            fidl::encoding::DynamicFlags::empty(),
543            _decode,
544        )
545    }
546
547    type ExplorePackageOverSocketResponseFut = fidl::client::QueryResponseFut<
548        LauncherExplorePackageOverSocketResult,
549        fidl::encoding::DefaultFuchsiaResourceDialect,
550    >;
551    fn r#explore_package_over_socket(
552        &self,
553        mut url: &str,
554        mut subpackages: &[String],
555        mut socket: fidl::Socket,
556        mut tool_urls: &[String],
557        mut command: Option<&str>,
558    ) -> Self::ExplorePackageOverSocketResponseFut {
559        fn _decode(
560            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
561        ) -> Result<LauncherExplorePackageOverSocketResult, fidl::Error> {
562            let _response = fidl::client::decode_transaction_body::<
563                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LauncherError>,
564                fidl::encoding::DefaultFuchsiaResourceDialect,
565                0x8e536067655b5a2,
566            >(_buf?)?;
567            Ok(_response.map(|x| x))
568        }
569        self.client.send_query_and_decode::<
570            LauncherExplorePackageOverSocketRequest,
571            LauncherExplorePackageOverSocketResult,
572        >(
573            (url, subpackages, socket, tool_urls, command,),
574            0x8e536067655b5a2,
575            fidl::encoding::DynamicFlags::empty(),
576            _decode,
577        )
578    }
579
580    type ExplorePackageOverSocket2ResponseFut = fidl::client::QueryResponseFut<
581        LauncherExplorePackageOverSocket2Result,
582        fidl::encoding::DefaultFuchsiaResourceDialect,
583    >;
584    fn r#explore_package_over_socket2(
585        &self,
586        mut fuchsia_pkg_resolver: FuchsiaPkgResolver,
587        mut url: &str,
588        mut subpackages: &[String],
589        mut socket: fidl::Socket,
590        mut tool_urls: &[String],
591        mut command: Option<&str>,
592    ) -> Self::ExplorePackageOverSocket2ResponseFut {
593        fn _decode(
594            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
595        ) -> Result<LauncherExplorePackageOverSocket2Result, fidl::Error> {
596            let _response = fidl::client::decode_transaction_body::<
597                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LauncherError>,
598                fidl::encoding::DefaultFuchsiaResourceDialect,
599                0x3884e07c1fa8d20b,
600            >(_buf?)?;
601            Ok(_response.map(|x| x))
602        }
603        self.client.send_query_and_decode::<
604            LauncherExplorePackageOverSocket2Request,
605            LauncherExplorePackageOverSocket2Result,
606        >(
607            (fuchsia_pkg_resolver, url, subpackages, socket, tool_urls, command,),
608            0x3884e07c1fa8d20b,
609            fidl::encoding::DynamicFlags::empty(),
610            _decode,
611        )
612    }
613}
614
615pub struct LauncherEventStream {
616    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
617}
618
619impl std::marker::Unpin for LauncherEventStream {}
620
621impl futures::stream::FusedStream for LauncherEventStream {
622    fn is_terminated(&self) -> bool {
623        self.event_receiver.is_terminated()
624    }
625}
626
627impl futures::Stream for LauncherEventStream {
628    type Item = Result<LauncherEvent, fidl::Error>;
629
630    fn poll_next(
631        mut self: std::pin::Pin<&mut Self>,
632        cx: &mut std::task::Context<'_>,
633    ) -> std::task::Poll<Option<Self::Item>> {
634        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
635            &mut self.event_receiver,
636            cx
637        )?) {
638            Some(buf) => std::task::Poll::Ready(Some(LauncherEvent::decode(buf))),
639            None => std::task::Poll::Ready(None),
640        }
641    }
642}
643
644#[derive(Debug)]
645pub enum LauncherEvent {
646    OnTerminated { return_code: i32 },
647}
648
649impl LauncherEvent {
650    #[allow(irrefutable_let_patterns)]
651    pub fn into_on_terminated(self) -> Option<i32> {
652        if let LauncherEvent::OnTerminated { return_code } = self {
653            Some((return_code))
654        } else {
655            None
656        }
657    }
658
659    /// Decodes a message buffer as a [`LauncherEvent`].
660    fn decode(
661        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
662    ) -> Result<LauncherEvent, fidl::Error> {
663        let (bytes, _handles) = buf.split_mut();
664        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
665        debug_assert_eq!(tx_header.tx_id, 0);
666        match tx_header.ordinal {
667            0x6e5422dc5fe6b3f2 => {
668                let mut out = fidl::new_empty!(
669                    LauncherOnTerminatedRequest,
670                    fidl::encoding::DefaultFuchsiaResourceDialect
671                );
672                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LauncherOnTerminatedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
673                Ok((LauncherEvent::OnTerminated { return_code: out.return_code }))
674            }
675            _ => Err(fidl::Error::UnknownOrdinal {
676                ordinal: tx_header.ordinal,
677                protocol_name: <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
678            }),
679        }
680    }
681}
682
683/// A Stream of incoming requests for fuchsia.dash/Launcher.
684pub struct LauncherRequestStream {
685    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
686    is_terminated: bool,
687}
688
689impl std::marker::Unpin for LauncherRequestStream {}
690
691impl futures::stream::FusedStream for LauncherRequestStream {
692    fn is_terminated(&self) -> bool {
693        self.is_terminated
694    }
695}
696
697impl fidl::endpoints::RequestStream for LauncherRequestStream {
698    type Protocol = LauncherMarker;
699    type ControlHandle = LauncherControlHandle;
700
701    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
702        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
703    }
704
705    fn control_handle(&self) -> Self::ControlHandle {
706        LauncherControlHandle { inner: self.inner.clone() }
707    }
708
709    fn into_inner(
710        self,
711    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
712    {
713        (self.inner, self.is_terminated)
714    }
715
716    fn from_inner(
717        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
718        is_terminated: bool,
719    ) -> Self {
720        Self { inner, is_terminated }
721    }
722}
723
724impl futures::Stream for LauncherRequestStream {
725    type Item = Result<LauncherRequest, fidl::Error>;
726
727    fn poll_next(
728        mut self: std::pin::Pin<&mut Self>,
729        cx: &mut std::task::Context<'_>,
730    ) -> std::task::Poll<Option<Self::Item>> {
731        let this = &mut *self;
732        if this.inner.check_shutdown(cx) {
733            this.is_terminated = true;
734            return std::task::Poll::Ready(None);
735        }
736        if this.is_terminated {
737            panic!("polled LauncherRequestStream after completion");
738        }
739        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
740            |bytes, handles| {
741                match this.inner.channel().read_etc(cx, bytes, handles) {
742                    std::task::Poll::Ready(Ok(())) => {}
743                    std::task::Poll::Pending => return std::task::Poll::Pending,
744                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
745                        this.is_terminated = true;
746                        return std::task::Poll::Ready(None);
747                    }
748                    std::task::Poll::Ready(Err(e)) => {
749                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
750                            e.into(),
751                        ))));
752                    }
753                }
754
755                // A message has been received from the channel
756                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
757
758                std::task::Poll::Ready(Some(match header.ordinal {
759                    0x22efaa9c12b8779f => {
760                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
761                        let mut req = fidl::new_empty!(
762                            LauncherExploreComponentOverPtyRequest,
763                            fidl::encoding::DefaultFuchsiaResourceDialect
764                        );
765                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LauncherExploreComponentOverPtyRequest>(&header, _body_bytes, handles, &mut req)?;
766                        let control_handle = LauncherControlHandle { inner: this.inner.clone() };
767                        Ok(LauncherRequest::ExploreComponentOverPty {
768                            moniker: req.moniker,
769                            pty: req.pty,
770                            tool_urls: req.tool_urls,
771                            command: req.command,
772                            ns_layout: req.ns_layout,
773
774                            responder: LauncherExploreComponentOverPtyResponder {
775                                control_handle: std::mem::ManuallyDrop::new(control_handle),
776                                tx_id: header.tx_id,
777                            },
778                        })
779                    }
780                    0x233557fb2b70eb68 => {
781                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
782                        let mut req = fidl::new_empty!(
783                            LauncherExploreComponentOverSocketRequest,
784                            fidl::encoding::DefaultFuchsiaResourceDialect
785                        );
786                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LauncherExploreComponentOverSocketRequest>(&header, _body_bytes, handles, &mut req)?;
787                        let control_handle = LauncherControlHandle { inner: this.inner.clone() };
788                        Ok(LauncherRequest::ExploreComponentOverSocket {
789                            moniker: req.moniker,
790                            socket: req.socket,
791                            tool_urls: req.tool_urls,
792                            command: req.command,
793                            ns_layout: req.ns_layout,
794
795                            responder: LauncherExploreComponentOverSocketResponder {
796                                control_handle: std::mem::ManuallyDrop::new(control_handle),
797                                tx_id: header.tx_id,
798                            },
799                        })
800                    }
801                    0x8e536067655b5a2 => {
802                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
803                        let mut req = fidl::new_empty!(
804                            LauncherExplorePackageOverSocketRequest,
805                            fidl::encoding::DefaultFuchsiaResourceDialect
806                        );
807                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LauncherExplorePackageOverSocketRequest>(&header, _body_bytes, handles, &mut req)?;
808                        let control_handle = LauncherControlHandle { inner: this.inner.clone() };
809                        Ok(LauncherRequest::ExplorePackageOverSocket {
810                            url: req.url,
811                            subpackages: req.subpackages,
812                            socket: req.socket,
813                            tool_urls: req.tool_urls,
814                            command: req.command,
815
816                            responder: LauncherExplorePackageOverSocketResponder {
817                                control_handle: std::mem::ManuallyDrop::new(control_handle),
818                                tx_id: header.tx_id,
819                            },
820                        })
821                    }
822                    0x3884e07c1fa8d20b => {
823                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
824                        let mut req = fidl::new_empty!(
825                            LauncherExplorePackageOverSocket2Request,
826                            fidl::encoding::DefaultFuchsiaResourceDialect
827                        );
828                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LauncherExplorePackageOverSocket2Request>(&header, _body_bytes, handles, &mut req)?;
829                        let control_handle = LauncherControlHandle { inner: this.inner.clone() };
830                        Ok(LauncherRequest::ExplorePackageOverSocket2 {
831                            fuchsia_pkg_resolver: req.fuchsia_pkg_resolver,
832                            url: req.url,
833                            subpackages: req.subpackages,
834                            socket: req.socket,
835                            tool_urls: req.tool_urls,
836                            command: req.command,
837
838                            responder: LauncherExplorePackageOverSocket2Responder {
839                                control_handle: std::mem::ManuallyDrop::new(control_handle),
840                                tx_id: header.tx_id,
841                            },
842                        })
843                    }
844                    _ => Err(fidl::Error::UnknownOrdinal {
845                        ordinal: header.ordinal,
846                        protocol_name:
847                            <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
848                    }),
849                }))
850            },
851        )
852    }
853}
854
855#[derive(Debug)]
856pub enum LauncherRequest {
857    /// Launch a dash process scoped to the component with the given moniker, forwarding the given
858    /// stdio PTY.
859    ExploreComponentOverPty {
860        moniker: String,
861        pty: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
862        tool_urls: Vec<String>,
863        command: Option<String>,
864        ns_layout: DashNamespaceLayout,
865        responder: LauncherExploreComponentOverPtyResponder,
866    },
867    /// Launch a dash process scoped to the component with the given moniker, forwarding the given
868    /// stdio socket.
869    ///
870    /// The dash launcher will implicitly create a PTY and transfer bytes between the PTY and
871    /// the socket.
872    ExploreComponentOverSocket {
873        moniker: String,
874        socket: fidl::Socket,
875        tool_urls: Vec<String>,
876        command: Option<String>,
877        ns_layout: DashNamespaceLayout,
878        responder: LauncherExploreComponentOverSocketResponder,
879    },
880    /// Launch a dash process with the indicated [sub]package loaded into the namespace at /pkg,
881    /// forwarding the given stdio socket.
882    ///
883    /// The dash launcher will implicitly create a PTY and transfer bytes between the PTY and
884    /// the socket.
885    ///
886    /// Always uses [`fuchsia.dash/FuchsiaPkgResolver.FULL`] to resolve package URLs with scheme
887    /// "fuchsia-pkg".
888    /// Use [`fuchsia.dash/Launcher.ExplorePackageOverSocket2`] instead to pick which resolver to
889    /// use with "fuchsia-pkg" URLs.
890    ExplorePackageOverSocket {
891        url: String,
892        subpackages: Vec<String>,
893        socket: fidl::Socket,
894        tool_urls: Vec<String>,
895        command: Option<String>,
896        responder: LauncherExplorePackageOverSocketResponder,
897    },
898    /// Launch a dash process with the indicated [sub]package loaded into the namespace at /pkg,
899    /// forwarding the given stdio socket.
900    ///
901    /// The dash launcher will implicitly create a PTY and transfer bytes between the PTY and
902    /// the socket.
903    ExplorePackageOverSocket2 {
904        fuchsia_pkg_resolver: FuchsiaPkgResolver,
905        url: String,
906        subpackages: Vec<String>,
907        socket: fidl::Socket,
908        tool_urls: Vec<String>,
909        command: Option<String>,
910        responder: LauncherExplorePackageOverSocket2Responder,
911    },
912}
913
914impl LauncherRequest {
915    #[allow(irrefutable_let_patterns)]
916    pub fn into_explore_component_over_pty(
917        self,
918    ) -> Option<(
919        String,
920        fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
921        Vec<String>,
922        Option<String>,
923        DashNamespaceLayout,
924        LauncherExploreComponentOverPtyResponder,
925    )> {
926        if let LauncherRequest::ExploreComponentOverPty {
927            moniker,
928            pty,
929            tool_urls,
930            command,
931            ns_layout,
932            responder,
933        } = self
934        {
935            Some((moniker, pty, tool_urls, command, ns_layout, responder))
936        } else {
937            None
938        }
939    }
940
941    #[allow(irrefutable_let_patterns)]
942    pub fn into_explore_component_over_socket(
943        self,
944    ) -> Option<(
945        String,
946        fidl::Socket,
947        Vec<String>,
948        Option<String>,
949        DashNamespaceLayout,
950        LauncherExploreComponentOverSocketResponder,
951    )> {
952        if let LauncherRequest::ExploreComponentOverSocket {
953            moniker,
954            socket,
955            tool_urls,
956            command,
957            ns_layout,
958            responder,
959        } = self
960        {
961            Some((moniker, socket, tool_urls, command, ns_layout, responder))
962        } else {
963            None
964        }
965    }
966
967    #[allow(irrefutable_let_patterns)]
968    pub fn into_explore_package_over_socket(
969        self,
970    ) -> Option<(
971        String,
972        Vec<String>,
973        fidl::Socket,
974        Vec<String>,
975        Option<String>,
976        LauncherExplorePackageOverSocketResponder,
977    )> {
978        if let LauncherRequest::ExplorePackageOverSocket {
979            url,
980            subpackages,
981            socket,
982            tool_urls,
983            command,
984            responder,
985        } = self
986        {
987            Some((url, subpackages, socket, tool_urls, command, responder))
988        } else {
989            None
990        }
991    }
992
993    #[allow(irrefutable_let_patterns)]
994    pub fn into_explore_package_over_socket2(
995        self,
996    ) -> Option<(
997        FuchsiaPkgResolver,
998        String,
999        Vec<String>,
1000        fidl::Socket,
1001        Vec<String>,
1002        Option<String>,
1003        LauncherExplorePackageOverSocket2Responder,
1004    )> {
1005        if let LauncherRequest::ExplorePackageOverSocket2 {
1006            fuchsia_pkg_resolver,
1007            url,
1008            subpackages,
1009            socket,
1010            tool_urls,
1011            command,
1012            responder,
1013        } = self
1014        {
1015            Some((fuchsia_pkg_resolver, url, subpackages, socket, tool_urls, command, responder))
1016        } else {
1017            None
1018        }
1019    }
1020
1021    /// Name of the method defined in FIDL
1022    pub fn method_name(&self) -> &'static str {
1023        match *self {
1024            LauncherRequest::ExploreComponentOverPty { .. } => "explore_component_over_pty",
1025            LauncherRequest::ExploreComponentOverSocket { .. } => "explore_component_over_socket",
1026            LauncherRequest::ExplorePackageOverSocket { .. } => "explore_package_over_socket",
1027            LauncherRequest::ExplorePackageOverSocket2 { .. } => "explore_package_over_socket2",
1028        }
1029    }
1030}
1031
1032#[derive(Debug, Clone)]
1033pub struct LauncherControlHandle {
1034    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1035}
1036
1037impl fidl::endpoints::ControlHandle for LauncherControlHandle {
1038    fn shutdown(&self) {
1039        self.inner.shutdown()
1040    }
1041    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1042        self.inner.shutdown_with_epitaph(status)
1043    }
1044
1045    fn is_closed(&self) -> bool {
1046        self.inner.channel().is_closed()
1047    }
1048    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1049        self.inner.channel().on_closed()
1050    }
1051
1052    #[cfg(target_os = "fuchsia")]
1053    fn signal_peer(
1054        &self,
1055        clear_mask: zx::Signals,
1056        set_mask: zx::Signals,
1057    ) -> Result<(), zx_status::Status> {
1058        use fidl::Peered;
1059        self.inner.channel().signal_peer(clear_mask, set_mask)
1060    }
1061}
1062
1063impl LauncherControlHandle {
1064    pub fn send_on_terminated(&self, mut return_code: i32) -> Result<(), fidl::Error> {
1065        self.inner.send::<LauncherOnTerminatedRequest>(
1066            (return_code,),
1067            0,
1068            0x6e5422dc5fe6b3f2,
1069            fidl::encoding::DynamicFlags::empty(),
1070        )
1071    }
1072}
1073
1074#[must_use = "FIDL methods require a response to be sent"]
1075#[derive(Debug)]
1076pub struct LauncherExploreComponentOverPtyResponder {
1077    control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
1078    tx_id: u32,
1079}
1080
1081/// Set the the channel to be shutdown (see [`LauncherControlHandle::shutdown`])
1082/// if the responder is dropped without sending a response, so that the client
1083/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1084impl std::ops::Drop for LauncherExploreComponentOverPtyResponder {
1085    fn drop(&mut self) {
1086        self.control_handle.shutdown();
1087        // Safety: drops once, never accessed again
1088        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1089    }
1090}
1091
1092impl fidl::endpoints::Responder for LauncherExploreComponentOverPtyResponder {
1093    type ControlHandle = LauncherControlHandle;
1094
1095    fn control_handle(&self) -> &LauncherControlHandle {
1096        &self.control_handle
1097    }
1098
1099    fn drop_without_shutdown(mut self) {
1100        // Safety: drops once, never accessed again due to mem::forget
1101        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1102        // Prevent Drop from running (which would shut down the channel)
1103        std::mem::forget(self);
1104    }
1105}
1106
1107impl LauncherExploreComponentOverPtyResponder {
1108    /// Sends a response to the FIDL transaction.
1109    ///
1110    /// Sets the channel to shutdown if an error occurs.
1111    pub fn send(self, mut result: Result<(), LauncherError>) -> Result<(), fidl::Error> {
1112        let _result = self.send_raw(result);
1113        if _result.is_err() {
1114            self.control_handle.shutdown();
1115        }
1116        self.drop_without_shutdown();
1117        _result
1118    }
1119
1120    /// Similar to "send" but does not shutdown the channel if an error occurs.
1121    pub fn send_no_shutdown_on_err(
1122        self,
1123        mut result: Result<(), LauncherError>,
1124    ) -> Result<(), fidl::Error> {
1125        let _result = self.send_raw(result);
1126        self.drop_without_shutdown();
1127        _result
1128    }
1129
1130    fn send_raw(&self, mut result: Result<(), LauncherError>) -> Result<(), fidl::Error> {
1131        self.control_handle.inner.send::<fidl::encoding::ResultType<
1132            fidl::encoding::EmptyStruct,
1133            LauncherError,
1134        >>(
1135            result,
1136            self.tx_id,
1137            0x22efaa9c12b8779f,
1138            fidl::encoding::DynamicFlags::empty(),
1139        )
1140    }
1141}
1142
1143#[must_use = "FIDL methods require a response to be sent"]
1144#[derive(Debug)]
1145pub struct LauncherExploreComponentOverSocketResponder {
1146    control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
1147    tx_id: u32,
1148}
1149
1150/// Set the the channel to be shutdown (see [`LauncherControlHandle::shutdown`])
1151/// if the responder is dropped without sending a response, so that the client
1152/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1153impl std::ops::Drop for LauncherExploreComponentOverSocketResponder {
1154    fn drop(&mut self) {
1155        self.control_handle.shutdown();
1156        // Safety: drops once, never accessed again
1157        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1158    }
1159}
1160
1161impl fidl::endpoints::Responder for LauncherExploreComponentOverSocketResponder {
1162    type ControlHandle = LauncherControlHandle;
1163
1164    fn control_handle(&self) -> &LauncherControlHandle {
1165        &self.control_handle
1166    }
1167
1168    fn drop_without_shutdown(mut self) {
1169        // Safety: drops once, never accessed again due to mem::forget
1170        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1171        // Prevent Drop from running (which would shut down the channel)
1172        std::mem::forget(self);
1173    }
1174}
1175
1176impl LauncherExploreComponentOverSocketResponder {
1177    /// Sends a response to the FIDL transaction.
1178    ///
1179    /// Sets the channel to shutdown if an error occurs.
1180    pub fn send(self, mut result: Result<(), LauncherError>) -> Result<(), fidl::Error> {
1181        let _result = self.send_raw(result);
1182        if _result.is_err() {
1183            self.control_handle.shutdown();
1184        }
1185        self.drop_without_shutdown();
1186        _result
1187    }
1188
1189    /// Similar to "send" but does not shutdown the channel if an error occurs.
1190    pub fn send_no_shutdown_on_err(
1191        self,
1192        mut result: Result<(), LauncherError>,
1193    ) -> Result<(), fidl::Error> {
1194        let _result = self.send_raw(result);
1195        self.drop_without_shutdown();
1196        _result
1197    }
1198
1199    fn send_raw(&self, mut result: Result<(), LauncherError>) -> Result<(), fidl::Error> {
1200        self.control_handle.inner.send::<fidl::encoding::ResultType<
1201            fidl::encoding::EmptyStruct,
1202            LauncherError,
1203        >>(
1204            result,
1205            self.tx_id,
1206            0x233557fb2b70eb68,
1207            fidl::encoding::DynamicFlags::empty(),
1208        )
1209    }
1210}
1211
1212#[must_use = "FIDL methods require a response to be sent"]
1213#[derive(Debug)]
1214pub struct LauncherExplorePackageOverSocketResponder {
1215    control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
1216    tx_id: u32,
1217}
1218
1219/// Set the the channel to be shutdown (see [`LauncherControlHandle::shutdown`])
1220/// if the responder is dropped without sending a response, so that the client
1221/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1222impl std::ops::Drop for LauncherExplorePackageOverSocketResponder {
1223    fn drop(&mut self) {
1224        self.control_handle.shutdown();
1225        // Safety: drops once, never accessed again
1226        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1227    }
1228}
1229
1230impl fidl::endpoints::Responder for LauncherExplorePackageOverSocketResponder {
1231    type ControlHandle = LauncherControlHandle;
1232
1233    fn control_handle(&self) -> &LauncherControlHandle {
1234        &self.control_handle
1235    }
1236
1237    fn drop_without_shutdown(mut self) {
1238        // Safety: drops once, never accessed again due to mem::forget
1239        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1240        // Prevent Drop from running (which would shut down the channel)
1241        std::mem::forget(self);
1242    }
1243}
1244
1245impl LauncherExplorePackageOverSocketResponder {
1246    /// Sends a response to the FIDL transaction.
1247    ///
1248    /// Sets the channel to shutdown if an error occurs.
1249    pub fn send(self, mut result: Result<(), LauncherError>) -> Result<(), fidl::Error> {
1250        let _result = self.send_raw(result);
1251        if _result.is_err() {
1252            self.control_handle.shutdown();
1253        }
1254        self.drop_without_shutdown();
1255        _result
1256    }
1257
1258    /// Similar to "send" but does not shutdown the channel if an error occurs.
1259    pub fn send_no_shutdown_on_err(
1260        self,
1261        mut result: Result<(), LauncherError>,
1262    ) -> Result<(), fidl::Error> {
1263        let _result = self.send_raw(result);
1264        self.drop_without_shutdown();
1265        _result
1266    }
1267
1268    fn send_raw(&self, mut result: Result<(), LauncherError>) -> Result<(), fidl::Error> {
1269        self.control_handle.inner.send::<fidl::encoding::ResultType<
1270            fidl::encoding::EmptyStruct,
1271            LauncherError,
1272        >>(
1273            result,
1274            self.tx_id,
1275            0x8e536067655b5a2,
1276            fidl::encoding::DynamicFlags::empty(),
1277        )
1278    }
1279}
1280
1281#[must_use = "FIDL methods require a response to be sent"]
1282#[derive(Debug)]
1283pub struct LauncherExplorePackageOverSocket2Responder {
1284    control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
1285    tx_id: u32,
1286}
1287
1288/// Set the the channel to be shutdown (see [`LauncherControlHandle::shutdown`])
1289/// if the responder is dropped without sending a response, so that the client
1290/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1291impl std::ops::Drop for LauncherExplorePackageOverSocket2Responder {
1292    fn drop(&mut self) {
1293        self.control_handle.shutdown();
1294        // Safety: drops once, never accessed again
1295        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1296    }
1297}
1298
1299impl fidl::endpoints::Responder for LauncherExplorePackageOverSocket2Responder {
1300    type ControlHandle = LauncherControlHandle;
1301
1302    fn control_handle(&self) -> &LauncherControlHandle {
1303        &self.control_handle
1304    }
1305
1306    fn drop_without_shutdown(mut self) {
1307        // Safety: drops once, never accessed again due to mem::forget
1308        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1309        // Prevent Drop from running (which would shut down the channel)
1310        std::mem::forget(self);
1311    }
1312}
1313
1314impl LauncherExplorePackageOverSocket2Responder {
1315    /// Sends a response to the FIDL transaction.
1316    ///
1317    /// Sets the channel to shutdown if an error occurs.
1318    pub fn send(self, mut result: Result<(), LauncherError>) -> Result<(), fidl::Error> {
1319        let _result = self.send_raw(result);
1320        if _result.is_err() {
1321            self.control_handle.shutdown();
1322        }
1323        self.drop_without_shutdown();
1324        _result
1325    }
1326
1327    /// Similar to "send" but does not shutdown the channel if an error occurs.
1328    pub fn send_no_shutdown_on_err(
1329        self,
1330        mut result: Result<(), LauncherError>,
1331    ) -> Result<(), fidl::Error> {
1332        let _result = self.send_raw(result);
1333        self.drop_without_shutdown();
1334        _result
1335    }
1336
1337    fn send_raw(&self, mut result: Result<(), LauncherError>) -> Result<(), fidl::Error> {
1338        self.control_handle.inner.send::<fidl::encoding::ResultType<
1339            fidl::encoding::EmptyStruct,
1340            LauncherError,
1341        >>(
1342            result,
1343            self.tx_id,
1344            0x3884e07c1fa8d20b,
1345            fidl::encoding::DynamicFlags::empty(),
1346        )
1347    }
1348}
1349
1350mod internal {
1351    use super::*;
1352
1353    impl fidl::encoding::ResourceTypeMarker for LauncherExploreComponentOverPtyRequest {
1354        type Borrowed<'a> = &'a mut Self;
1355        fn take_or_borrow<'a>(
1356            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1357        ) -> Self::Borrowed<'a> {
1358            value
1359        }
1360    }
1361
1362    unsafe impl fidl::encoding::TypeMarker for LauncherExploreComponentOverPtyRequest {
1363        type Owned = Self;
1364
1365        #[inline(always)]
1366        fn inline_align(_context: fidl::encoding::Context) -> usize {
1367            8
1368        }
1369
1370        #[inline(always)]
1371        fn inline_size(_context: fidl::encoding::Context) -> usize {
1372            64
1373        }
1374    }
1375
1376    unsafe impl
1377        fidl::encoding::Encode<
1378            LauncherExploreComponentOverPtyRequest,
1379            fidl::encoding::DefaultFuchsiaResourceDialect,
1380        > for &mut LauncherExploreComponentOverPtyRequest
1381    {
1382        #[inline]
1383        unsafe fn encode(
1384            self,
1385            encoder: &mut fidl::encoding::Encoder<
1386                '_,
1387                fidl::encoding::DefaultFuchsiaResourceDialect,
1388            >,
1389            offset: usize,
1390            _depth: fidl::encoding::Depth,
1391        ) -> fidl::Result<()> {
1392            encoder.debug_check_bounds::<LauncherExploreComponentOverPtyRequest>(offset);
1393            // Delegate to tuple encoding.
1394            fidl::encoding::Encode::<LauncherExploreComponentOverPtyRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1395                (
1396                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.moniker),
1397                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_pty::DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.pty),
1398                    <fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20> as fidl::encoding::ValueTypeMarker>::borrow(&self.tool_urls),
1399                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.command),
1400                    <DashNamespaceLayout as fidl::encoding::ValueTypeMarker>::borrow(&self.ns_layout),
1401                ),
1402                encoder, offset, _depth
1403            )
1404        }
1405    }
1406    unsafe impl<
1407        T0: fidl::encoding::Encode<
1408                fidl::encoding::UnboundedString,
1409                fidl::encoding::DefaultFuchsiaResourceDialect,
1410            >,
1411        T1: fidl::encoding::Encode<
1412                fidl::encoding::Endpoint<
1413                    fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
1414                >,
1415                fidl::encoding::DefaultFuchsiaResourceDialect,
1416            >,
1417        T2: fidl::encoding::Encode<
1418                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
1419                fidl::encoding::DefaultFuchsiaResourceDialect,
1420            >,
1421        T3: fidl::encoding::Encode<
1422                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1423                fidl::encoding::DefaultFuchsiaResourceDialect,
1424            >,
1425        T4: fidl::encoding::Encode<DashNamespaceLayout, fidl::encoding::DefaultFuchsiaResourceDialect>,
1426    >
1427        fidl::encoding::Encode<
1428            LauncherExploreComponentOverPtyRequest,
1429            fidl::encoding::DefaultFuchsiaResourceDialect,
1430        > for (T0, T1, T2, T3, T4)
1431    {
1432        #[inline]
1433        unsafe fn encode(
1434            self,
1435            encoder: &mut fidl::encoding::Encoder<
1436                '_,
1437                fidl::encoding::DefaultFuchsiaResourceDialect,
1438            >,
1439            offset: usize,
1440            depth: fidl::encoding::Depth,
1441        ) -> fidl::Result<()> {
1442            encoder.debug_check_bounds::<LauncherExploreComponentOverPtyRequest>(offset);
1443            // Zero out padding regions. There's no need to apply masks
1444            // because the unmasked parts will be overwritten by fields.
1445            unsafe {
1446                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1447                (ptr as *mut u64).write_unaligned(0);
1448            }
1449            unsafe {
1450                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(56);
1451                (ptr as *mut u64).write_unaligned(0);
1452            }
1453            // Write the fields.
1454            self.0.encode(encoder, offset + 0, depth)?;
1455            self.1.encode(encoder, offset + 16, depth)?;
1456            self.2.encode(encoder, offset + 24, depth)?;
1457            self.3.encode(encoder, offset + 40, depth)?;
1458            self.4.encode(encoder, offset + 56, depth)?;
1459            Ok(())
1460        }
1461    }
1462
1463    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1464        for LauncherExploreComponentOverPtyRequest
1465    {
1466        #[inline(always)]
1467        fn new_empty() -> Self {
1468            Self {
1469                moniker: fidl::new_empty!(
1470                    fidl::encoding::UnboundedString,
1471                    fidl::encoding::DefaultFuchsiaResourceDialect
1472                ),
1473                pty: fidl::new_empty!(
1474                    fidl::encoding::Endpoint<
1475                        fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
1476                    >,
1477                    fidl::encoding::DefaultFuchsiaResourceDialect
1478                ),
1479                tool_urls: fidl::new_empty!(
1480                    fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
1481                    fidl::encoding::DefaultFuchsiaResourceDialect
1482                ),
1483                command: fidl::new_empty!(
1484                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1485                    fidl::encoding::DefaultFuchsiaResourceDialect
1486                ),
1487                ns_layout: fidl::new_empty!(
1488                    DashNamespaceLayout,
1489                    fidl::encoding::DefaultFuchsiaResourceDialect
1490                ),
1491            }
1492        }
1493
1494        #[inline]
1495        unsafe fn decode(
1496            &mut self,
1497            decoder: &mut fidl::encoding::Decoder<
1498                '_,
1499                fidl::encoding::DefaultFuchsiaResourceDialect,
1500            >,
1501            offset: usize,
1502            _depth: fidl::encoding::Depth,
1503        ) -> fidl::Result<()> {
1504            decoder.debug_check_bounds::<Self>(offset);
1505            // Verify that padding bytes are zero.
1506            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1507            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1508            let mask = 0xffffffff00000000u64;
1509            let maskedval = padval & mask;
1510            if maskedval != 0 {
1511                return Err(fidl::Error::NonZeroPadding {
1512                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1513                });
1514            }
1515            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(56) };
1516            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1517            let mask = 0xffffffff00000000u64;
1518            let maskedval = padval & mask;
1519            if maskedval != 0 {
1520                return Err(fidl::Error::NonZeroPadding {
1521                    padding_start: offset + 56 + ((mask as u64).trailing_zeros() / 8) as usize,
1522                });
1523            }
1524            fidl::decode!(
1525                fidl::encoding::UnboundedString,
1526                fidl::encoding::DefaultFuchsiaResourceDialect,
1527                &mut self.moniker,
1528                decoder,
1529                offset + 0,
1530                _depth
1531            )?;
1532            fidl::decode!(
1533                fidl::encoding::Endpoint<
1534                    fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
1535                >,
1536                fidl::encoding::DefaultFuchsiaResourceDialect,
1537                &mut self.pty,
1538                decoder,
1539                offset + 16,
1540                _depth
1541            )?;
1542            fidl::decode!(
1543                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
1544                fidl::encoding::DefaultFuchsiaResourceDialect,
1545                &mut self.tool_urls,
1546                decoder,
1547                offset + 24,
1548                _depth
1549            )?;
1550            fidl::decode!(
1551                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1552                fidl::encoding::DefaultFuchsiaResourceDialect,
1553                &mut self.command,
1554                decoder,
1555                offset + 40,
1556                _depth
1557            )?;
1558            fidl::decode!(
1559                DashNamespaceLayout,
1560                fidl::encoding::DefaultFuchsiaResourceDialect,
1561                &mut self.ns_layout,
1562                decoder,
1563                offset + 56,
1564                _depth
1565            )?;
1566            Ok(())
1567        }
1568    }
1569
1570    impl fidl::encoding::ResourceTypeMarker for LauncherExploreComponentOverSocketRequest {
1571        type Borrowed<'a> = &'a mut Self;
1572        fn take_or_borrow<'a>(
1573            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1574        ) -> Self::Borrowed<'a> {
1575            value
1576        }
1577    }
1578
1579    unsafe impl fidl::encoding::TypeMarker for LauncherExploreComponentOverSocketRequest {
1580        type Owned = Self;
1581
1582        #[inline(always)]
1583        fn inline_align(_context: fidl::encoding::Context) -> usize {
1584            8
1585        }
1586
1587        #[inline(always)]
1588        fn inline_size(_context: fidl::encoding::Context) -> usize {
1589            64
1590        }
1591    }
1592
1593    unsafe impl
1594        fidl::encoding::Encode<
1595            LauncherExploreComponentOverSocketRequest,
1596            fidl::encoding::DefaultFuchsiaResourceDialect,
1597        > for &mut LauncherExploreComponentOverSocketRequest
1598    {
1599        #[inline]
1600        unsafe fn encode(
1601            self,
1602            encoder: &mut fidl::encoding::Encoder<
1603                '_,
1604                fidl::encoding::DefaultFuchsiaResourceDialect,
1605            >,
1606            offset: usize,
1607            _depth: fidl::encoding::Depth,
1608        ) -> fidl::Result<()> {
1609            encoder.debug_check_bounds::<LauncherExploreComponentOverSocketRequest>(offset);
1610            // Delegate to tuple encoding.
1611            fidl::encoding::Encode::<LauncherExploreComponentOverSocketRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1612                (
1613                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.moniker),
1614                    <fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.socket),
1615                    <fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20> as fidl::encoding::ValueTypeMarker>::borrow(&self.tool_urls),
1616                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.command),
1617                    <DashNamespaceLayout as fidl::encoding::ValueTypeMarker>::borrow(&self.ns_layout),
1618                ),
1619                encoder, offset, _depth
1620            )
1621        }
1622    }
1623    unsafe impl<
1624        T0: fidl::encoding::Encode<
1625                fidl::encoding::UnboundedString,
1626                fidl::encoding::DefaultFuchsiaResourceDialect,
1627            >,
1628        T1: fidl::encoding::Encode<
1629                fidl::encoding::HandleType<
1630                    fidl::Socket,
1631                    { fidl::ObjectType::SOCKET.into_raw() },
1632                    2147483648,
1633                >,
1634                fidl::encoding::DefaultFuchsiaResourceDialect,
1635            >,
1636        T2: fidl::encoding::Encode<
1637                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
1638                fidl::encoding::DefaultFuchsiaResourceDialect,
1639            >,
1640        T3: fidl::encoding::Encode<
1641                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1642                fidl::encoding::DefaultFuchsiaResourceDialect,
1643            >,
1644        T4: fidl::encoding::Encode<DashNamespaceLayout, fidl::encoding::DefaultFuchsiaResourceDialect>,
1645    >
1646        fidl::encoding::Encode<
1647            LauncherExploreComponentOverSocketRequest,
1648            fidl::encoding::DefaultFuchsiaResourceDialect,
1649        > for (T0, T1, T2, T3, T4)
1650    {
1651        #[inline]
1652        unsafe fn encode(
1653            self,
1654            encoder: &mut fidl::encoding::Encoder<
1655                '_,
1656                fidl::encoding::DefaultFuchsiaResourceDialect,
1657            >,
1658            offset: usize,
1659            depth: fidl::encoding::Depth,
1660        ) -> fidl::Result<()> {
1661            encoder.debug_check_bounds::<LauncherExploreComponentOverSocketRequest>(offset);
1662            // Zero out padding regions. There's no need to apply masks
1663            // because the unmasked parts will be overwritten by fields.
1664            unsafe {
1665                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1666                (ptr as *mut u64).write_unaligned(0);
1667            }
1668            unsafe {
1669                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(56);
1670                (ptr as *mut u64).write_unaligned(0);
1671            }
1672            // Write the fields.
1673            self.0.encode(encoder, offset + 0, depth)?;
1674            self.1.encode(encoder, offset + 16, depth)?;
1675            self.2.encode(encoder, offset + 24, depth)?;
1676            self.3.encode(encoder, offset + 40, depth)?;
1677            self.4.encode(encoder, offset + 56, depth)?;
1678            Ok(())
1679        }
1680    }
1681
1682    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1683        for LauncherExploreComponentOverSocketRequest
1684    {
1685        #[inline(always)]
1686        fn new_empty() -> Self {
1687            Self {
1688                moniker: fidl::new_empty!(
1689                    fidl::encoding::UnboundedString,
1690                    fidl::encoding::DefaultFuchsiaResourceDialect
1691                ),
1692                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1693                tool_urls: fidl::new_empty!(
1694                    fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
1695                    fidl::encoding::DefaultFuchsiaResourceDialect
1696                ),
1697                command: fidl::new_empty!(
1698                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1699                    fidl::encoding::DefaultFuchsiaResourceDialect
1700                ),
1701                ns_layout: fidl::new_empty!(
1702                    DashNamespaceLayout,
1703                    fidl::encoding::DefaultFuchsiaResourceDialect
1704                ),
1705            }
1706        }
1707
1708        #[inline]
1709        unsafe fn decode(
1710            &mut self,
1711            decoder: &mut fidl::encoding::Decoder<
1712                '_,
1713                fidl::encoding::DefaultFuchsiaResourceDialect,
1714            >,
1715            offset: usize,
1716            _depth: fidl::encoding::Depth,
1717        ) -> fidl::Result<()> {
1718            decoder.debug_check_bounds::<Self>(offset);
1719            // Verify that padding bytes are zero.
1720            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1721            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1722            let mask = 0xffffffff00000000u64;
1723            let maskedval = padval & mask;
1724            if maskedval != 0 {
1725                return Err(fidl::Error::NonZeroPadding {
1726                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1727                });
1728            }
1729            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(56) };
1730            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1731            let mask = 0xffffffff00000000u64;
1732            let maskedval = padval & mask;
1733            if maskedval != 0 {
1734                return Err(fidl::Error::NonZeroPadding {
1735                    padding_start: offset + 56 + ((mask as u64).trailing_zeros() / 8) as usize,
1736                });
1737            }
1738            fidl::decode!(
1739                fidl::encoding::UnboundedString,
1740                fidl::encoding::DefaultFuchsiaResourceDialect,
1741                &mut self.moniker,
1742                decoder,
1743                offset + 0,
1744                _depth
1745            )?;
1746            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 16, _depth)?;
1747            fidl::decode!(
1748                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
1749                fidl::encoding::DefaultFuchsiaResourceDialect,
1750                &mut self.tool_urls,
1751                decoder,
1752                offset + 24,
1753                _depth
1754            )?;
1755            fidl::decode!(
1756                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1757                fidl::encoding::DefaultFuchsiaResourceDialect,
1758                &mut self.command,
1759                decoder,
1760                offset + 40,
1761                _depth
1762            )?;
1763            fidl::decode!(
1764                DashNamespaceLayout,
1765                fidl::encoding::DefaultFuchsiaResourceDialect,
1766                &mut self.ns_layout,
1767                decoder,
1768                offset + 56,
1769                _depth
1770            )?;
1771            Ok(())
1772        }
1773    }
1774
1775    impl fidl::encoding::ResourceTypeMarker for LauncherExplorePackageOverSocket2Request {
1776        type Borrowed<'a> = &'a mut Self;
1777        fn take_or_borrow<'a>(
1778            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1779        ) -> Self::Borrowed<'a> {
1780            value
1781        }
1782    }
1783
1784    unsafe impl fidl::encoding::TypeMarker for LauncherExplorePackageOverSocket2Request {
1785        type Owned = Self;
1786
1787        #[inline(always)]
1788        fn inline_align(_context: fidl::encoding::Context) -> usize {
1789            8
1790        }
1791
1792        #[inline(always)]
1793        fn inline_size(_context: fidl::encoding::Context) -> usize {
1794            80
1795        }
1796    }
1797
1798    unsafe impl
1799        fidl::encoding::Encode<
1800            LauncherExplorePackageOverSocket2Request,
1801            fidl::encoding::DefaultFuchsiaResourceDialect,
1802        > for &mut LauncherExplorePackageOverSocket2Request
1803    {
1804        #[inline]
1805        unsafe fn encode(
1806            self,
1807            encoder: &mut fidl::encoding::Encoder<
1808                '_,
1809                fidl::encoding::DefaultFuchsiaResourceDialect,
1810            >,
1811            offset: usize,
1812            _depth: fidl::encoding::Depth,
1813        ) -> fidl::Result<()> {
1814            encoder.debug_check_bounds::<LauncherExplorePackageOverSocket2Request>(offset);
1815            // Delegate to tuple encoding.
1816            fidl::encoding::Encode::<LauncherExplorePackageOverSocket2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1817                (
1818                    <FuchsiaPkgResolver as fidl::encoding::ValueTypeMarker>::borrow(&self.fuchsia_pkg_resolver),
1819                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
1820                    <fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.subpackages),
1821                    <fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.socket),
1822                    <fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20> as fidl::encoding::ValueTypeMarker>::borrow(&self.tool_urls),
1823                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.command),
1824                ),
1825                encoder, offset, _depth
1826            )
1827        }
1828    }
1829    unsafe impl<
1830        T0: fidl::encoding::Encode<FuchsiaPkgResolver, fidl::encoding::DefaultFuchsiaResourceDialect>,
1831        T1: fidl::encoding::Encode<
1832                fidl::encoding::UnboundedString,
1833                fidl::encoding::DefaultFuchsiaResourceDialect,
1834            >,
1835        T2: fidl::encoding::Encode<
1836                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1837                fidl::encoding::DefaultFuchsiaResourceDialect,
1838            >,
1839        T3: fidl::encoding::Encode<
1840                fidl::encoding::HandleType<
1841                    fidl::Socket,
1842                    { fidl::ObjectType::SOCKET.into_raw() },
1843                    2147483648,
1844                >,
1845                fidl::encoding::DefaultFuchsiaResourceDialect,
1846            >,
1847        T4: fidl::encoding::Encode<
1848                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
1849                fidl::encoding::DefaultFuchsiaResourceDialect,
1850            >,
1851        T5: fidl::encoding::Encode<
1852                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1853                fidl::encoding::DefaultFuchsiaResourceDialect,
1854            >,
1855    >
1856        fidl::encoding::Encode<
1857            LauncherExplorePackageOverSocket2Request,
1858            fidl::encoding::DefaultFuchsiaResourceDialect,
1859        > for (T0, T1, T2, T3, T4, T5)
1860    {
1861        #[inline]
1862        unsafe fn encode(
1863            self,
1864            encoder: &mut fidl::encoding::Encoder<
1865                '_,
1866                fidl::encoding::DefaultFuchsiaResourceDialect,
1867            >,
1868            offset: usize,
1869            depth: fidl::encoding::Depth,
1870        ) -> fidl::Result<()> {
1871            encoder.debug_check_bounds::<LauncherExplorePackageOverSocket2Request>(offset);
1872            // Zero out padding regions. There's no need to apply masks
1873            // because the unmasked parts will be overwritten by fields.
1874            unsafe {
1875                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1876                (ptr as *mut u64).write_unaligned(0);
1877            }
1878            unsafe {
1879                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
1880                (ptr as *mut u64).write_unaligned(0);
1881            }
1882            // Write the fields.
1883            self.0.encode(encoder, offset + 0, depth)?;
1884            self.1.encode(encoder, offset + 8, depth)?;
1885            self.2.encode(encoder, offset + 24, depth)?;
1886            self.3.encode(encoder, offset + 40, depth)?;
1887            self.4.encode(encoder, offset + 48, depth)?;
1888            self.5.encode(encoder, offset + 64, depth)?;
1889            Ok(())
1890        }
1891    }
1892
1893    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1894        for LauncherExplorePackageOverSocket2Request
1895    {
1896        #[inline(always)]
1897        fn new_empty() -> Self {
1898            Self {
1899                fuchsia_pkg_resolver: fidl::new_empty!(
1900                    FuchsiaPkgResolver,
1901                    fidl::encoding::DefaultFuchsiaResourceDialect
1902                ),
1903                url: fidl::new_empty!(
1904                    fidl::encoding::UnboundedString,
1905                    fidl::encoding::DefaultFuchsiaResourceDialect
1906                ),
1907                subpackages: fidl::new_empty!(
1908                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1909                    fidl::encoding::DefaultFuchsiaResourceDialect
1910                ),
1911                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1912                tool_urls: fidl::new_empty!(
1913                    fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
1914                    fidl::encoding::DefaultFuchsiaResourceDialect
1915                ),
1916                command: fidl::new_empty!(
1917                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1918                    fidl::encoding::DefaultFuchsiaResourceDialect
1919                ),
1920            }
1921        }
1922
1923        #[inline]
1924        unsafe fn decode(
1925            &mut self,
1926            decoder: &mut fidl::encoding::Decoder<
1927                '_,
1928                fidl::encoding::DefaultFuchsiaResourceDialect,
1929            >,
1930            offset: usize,
1931            _depth: fidl::encoding::Depth,
1932        ) -> fidl::Result<()> {
1933            decoder.debug_check_bounds::<Self>(offset);
1934            // Verify that padding bytes are zero.
1935            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1936            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1937            let mask = 0xffffffff00000000u64;
1938            let maskedval = padval & mask;
1939            if maskedval != 0 {
1940                return Err(fidl::Error::NonZeroPadding {
1941                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1942                });
1943            }
1944            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
1945            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1946            let mask = 0xffffffff00000000u64;
1947            let maskedval = padval & mask;
1948            if maskedval != 0 {
1949                return Err(fidl::Error::NonZeroPadding {
1950                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
1951                });
1952            }
1953            fidl::decode!(
1954                FuchsiaPkgResolver,
1955                fidl::encoding::DefaultFuchsiaResourceDialect,
1956                &mut self.fuchsia_pkg_resolver,
1957                decoder,
1958                offset + 0,
1959                _depth
1960            )?;
1961            fidl::decode!(
1962                fidl::encoding::UnboundedString,
1963                fidl::encoding::DefaultFuchsiaResourceDialect,
1964                &mut self.url,
1965                decoder,
1966                offset + 8,
1967                _depth
1968            )?;
1969            fidl::decode!(
1970                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1971                fidl::encoding::DefaultFuchsiaResourceDialect,
1972                &mut self.subpackages,
1973                decoder,
1974                offset + 24,
1975                _depth
1976            )?;
1977            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 40, _depth)?;
1978            fidl::decode!(
1979                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
1980                fidl::encoding::DefaultFuchsiaResourceDialect,
1981                &mut self.tool_urls,
1982                decoder,
1983                offset + 48,
1984                _depth
1985            )?;
1986            fidl::decode!(
1987                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1988                fidl::encoding::DefaultFuchsiaResourceDialect,
1989                &mut self.command,
1990                decoder,
1991                offset + 64,
1992                _depth
1993            )?;
1994            Ok(())
1995        }
1996    }
1997
1998    impl fidl::encoding::ResourceTypeMarker for LauncherExplorePackageOverSocketRequest {
1999        type Borrowed<'a> = &'a mut Self;
2000        fn take_or_borrow<'a>(
2001            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2002        ) -> Self::Borrowed<'a> {
2003            value
2004        }
2005    }
2006
2007    unsafe impl fidl::encoding::TypeMarker for LauncherExplorePackageOverSocketRequest {
2008        type Owned = Self;
2009
2010        #[inline(always)]
2011        fn inline_align(_context: fidl::encoding::Context) -> usize {
2012            8
2013        }
2014
2015        #[inline(always)]
2016        fn inline_size(_context: fidl::encoding::Context) -> usize {
2017            72
2018        }
2019    }
2020
2021    unsafe impl
2022        fidl::encoding::Encode<
2023            LauncherExplorePackageOverSocketRequest,
2024            fidl::encoding::DefaultFuchsiaResourceDialect,
2025        > for &mut LauncherExplorePackageOverSocketRequest
2026    {
2027        #[inline]
2028        unsafe fn encode(
2029            self,
2030            encoder: &mut fidl::encoding::Encoder<
2031                '_,
2032                fidl::encoding::DefaultFuchsiaResourceDialect,
2033            >,
2034            offset: usize,
2035            _depth: fidl::encoding::Depth,
2036        ) -> fidl::Result<()> {
2037            encoder.debug_check_bounds::<LauncherExplorePackageOverSocketRequest>(offset);
2038            // Delegate to tuple encoding.
2039            fidl::encoding::Encode::<LauncherExplorePackageOverSocketRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2040                (
2041                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
2042                    <fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.subpackages),
2043                    <fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.socket),
2044                    <fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20> as fidl::encoding::ValueTypeMarker>::borrow(&self.tool_urls),
2045                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.command),
2046                ),
2047                encoder, offset, _depth
2048            )
2049        }
2050    }
2051    unsafe impl<
2052        T0: fidl::encoding::Encode<
2053                fidl::encoding::UnboundedString,
2054                fidl::encoding::DefaultFuchsiaResourceDialect,
2055            >,
2056        T1: fidl::encoding::Encode<
2057                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2058                fidl::encoding::DefaultFuchsiaResourceDialect,
2059            >,
2060        T2: fidl::encoding::Encode<
2061                fidl::encoding::HandleType<
2062                    fidl::Socket,
2063                    { fidl::ObjectType::SOCKET.into_raw() },
2064                    2147483648,
2065                >,
2066                fidl::encoding::DefaultFuchsiaResourceDialect,
2067            >,
2068        T3: fidl::encoding::Encode<
2069                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
2070                fidl::encoding::DefaultFuchsiaResourceDialect,
2071            >,
2072        T4: fidl::encoding::Encode<
2073                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
2074                fidl::encoding::DefaultFuchsiaResourceDialect,
2075            >,
2076    >
2077        fidl::encoding::Encode<
2078            LauncherExplorePackageOverSocketRequest,
2079            fidl::encoding::DefaultFuchsiaResourceDialect,
2080        > for (T0, T1, T2, T3, T4)
2081    {
2082        #[inline]
2083        unsafe fn encode(
2084            self,
2085            encoder: &mut fidl::encoding::Encoder<
2086                '_,
2087                fidl::encoding::DefaultFuchsiaResourceDialect,
2088            >,
2089            offset: usize,
2090            depth: fidl::encoding::Depth,
2091        ) -> fidl::Result<()> {
2092            encoder.debug_check_bounds::<LauncherExplorePackageOverSocketRequest>(offset);
2093            // Zero out padding regions. There's no need to apply masks
2094            // because the unmasked parts will be overwritten by fields.
2095            unsafe {
2096                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
2097                (ptr as *mut u64).write_unaligned(0);
2098            }
2099            // Write the fields.
2100            self.0.encode(encoder, offset + 0, depth)?;
2101            self.1.encode(encoder, offset + 16, depth)?;
2102            self.2.encode(encoder, offset + 32, depth)?;
2103            self.3.encode(encoder, offset + 40, depth)?;
2104            self.4.encode(encoder, offset + 56, depth)?;
2105            Ok(())
2106        }
2107    }
2108
2109    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2110        for LauncherExplorePackageOverSocketRequest
2111    {
2112        #[inline(always)]
2113        fn new_empty() -> Self {
2114            Self {
2115                url: fidl::new_empty!(
2116                    fidl::encoding::UnboundedString,
2117                    fidl::encoding::DefaultFuchsiaResourceDialect
2118                ),
2119                subpackages: fidl::new_empty!(
2120                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2121                    fidl::encoding::DefaultFuchsiaResourceDialect
2122                ),
2123                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2124                tool_urls: fidl::new_empty!(
2125                    fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
2126                    fidl::encoding::DefaultFuchsiaResourceDialect
2127                ),
2128                command: fidl::new_empty!(
2129                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
2130                    fidl::encoding::DefaultFuchsiaResourceDialect
2131                ),
2132            }
2133        }
2134
2135        #[inline]
2136        unsafe fn decode(
2137            &mut self,
2138            decoder: &mut fidl::encoding::Decoder<
2139                '_,
2140                fidl::encoding::DefaultFuchsiaResourceDialect,
2141            >,
2142            offset: usize,
2143            _depth: fidl::encoding::Depth,
2144        ) -> fidl::Result<()> {
2145            decoder.debug_check_bounds::<Self>(offset);
2146            // Verify that padding bytes are zero.
2147            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
2148            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2149            let mask = 0xffffffff00000000u64;
2150            let maskedval = padval & mask;
2151            if maskedval != 0 {
2152                return Err(fidl::Error::NonZeroPadding {
2153                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
2154                });
2155            }
2156            fidl::decode!(
2157                fidl::encoding::UnboundedString,
2158                fidl::encoding::DefaultFuchsiaResourceDialect,
2159                &mut self.url,
2160                decoder,
2161                offset + 0,
2162                _depth
2163            )?;
2164            fidl::decode!(
2165                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2166                fidl::encoding::DefaultFuchsiaResourceDialect,
2167                &mut self.subpackages,
2168                decoder,
2169                offset + 16,
2170                _depth
2171            )?;
2172            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 32, _depth)?;
2173            fidl::decode!(
2174                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
2175                fidl::encoding::DefaultFuchsiaResourceDialect,
2176                &mut self.tool_urls,
2177                decoder,
2178                offset + 40,
2179                _depth
2180            )?;
2181            fidl::decode!(
2182                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
2183                fidl::encoding::DefaultFuchsiaResourceDialect,
2184                &mut self.command,
2185                decoder,
2186                offset + 56,
2187                _depth
2188            )?;
2189            Ok(())
2190        }
2191    }
2192}