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::NullableHandle {
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
1042    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1043        self.inner.shutdown_with_epitaph(status)
1044    }
1045
1046    fn is_closed(&self) -> bool {
1047        self.inner.channel().is_closed()
1048    }
1049    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1050        self.inner.channel().on_closed()
1051    }
1052
1053    #[cfg(target_os = "fuchsia")]
1054    fn signal_peer(
1055        &self,
1056        clear_mask: zx::Signals,
1057        set_mask: zx::Signals,
1058    ) -> Result<(), zx_status::Status> {
1059        use fidl::Peered;
1060        self.inner.channel().signal_peer(clear_mask, set_mask)
1061    }
1062}
1063
1064impl LauncherControlHandle {
1065    pub fn send_on_terminated(&self, mut return_code: i32) -> Result<(), fidl::Error> {
1066        self.inner.send::<LauncherOnTerminatedRequest>(
1067            (return_code,),
1068            0,
1069            0x6e5422dc5fe6b3f2,
1070            fidl::encoding::DynamicFlags::empty(),
1071        )
1072    }
1073}
1074
1075#[must_use = "FIDL methods require a response to be sent"]
1076#[derive(Debug)]
1077pub struct LauncherExploreComponentOverPtyResponder {
1078    control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
1079    tx_id: u32,
1080}
1081
1082/// Set the the channel to be shutdown (see [`LauncherControlHandle::shutdown`])
1083/// if the responder is dropped without sending a response, so that the client
1084/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1085impl std::ops::Drop for LauncherExploreComponentOverPtyResponder {
1086    fn drop(&mut self) {
1087        self.control_handle.shutdown();
1088        // Safety: drops once, never accessed again
1089        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1090    }
1091}
1092
1093impl fidl::endpoints::Responder for LauncherExploreComponentOverPtyResponder {
1094    type ControlHandle = LauncherControlHandle;
1095
1096    fn control_handle(&self) -> &LauncherControlHandle {
1097        &self.control_handle
1098    }
1099
1100    fn drop_without_shutdown(mut self) {
1101        // Safety: drops once, never accessed again due to mem::forget
1102        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1103        // Prevent Drop from running (which would shut down the channel)
1104        std::mem::forget(self);
1105    }
1106}
1107
1108impl LauncherExploreComponentOverPtyResponder {
1109    /// Sends a response to the FIDL transaction.
1110    ///
1111    /// Sets the channel to shutdown if an error occurs.
1112    pub fn send(self, mut result: Result<(), LauncherError>) -> Result<(), fidl::Error> {
1113        let _result = self.send_raw(result);
1114        if _result.is_err() {
1115            self.control_handle.shutdown();
1116        }
1117        self.drop_without_shutdown();
1118        _result
1119    }
1120
1121    /// Similar to "send" but does not shutdown the channel if an error occurs.
1122    pub fn send_no_shutdown_on_err(
1123        self,
1124        mut result: Result<(), LauncherError>,
1125    ) -> Result<(), fidl::Error> {
1126        let _result = self.send_raw(result);
1127        self.drop_without_shutdown();
1128        _result
1129    }
1130
1131    fn send_raw(&self, mut result: Result<(), LauncherError>) -> Result<(), fidl::Error> {
1132        self.control_handle.inner.send::<fidl::encoding::ResultType<
1133            fidl::encoding::EmptyStruct,
1134            LauncherError,
1135        >>(
1136            result,
1137            self.tx_id,
1138            0x22efaa9c12b8779f,
1139            fidl::encoding::DynamicFlags::empty(),
1140        )
1141    }
1142}
1143
1144#[must_use = "FIDL methods require a response to be sent"]
1145#[derive(Debug)]
1146pub struct LauncherExploreComponentOverSocketResponder {
1147    control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
1148    tx_id: u32,
1149}
1150
1151/// Set the the channel to be shutdown (see [`LauncherControlHandle::shutdown`])
1152/// if the responder is dropped without sending a response, so that the client
1153/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1154impl std::ops::Drop for LauncherExploreComponentOverSocketResponder {
1155    fn drop(&mut self) {
1156        self.control_handle.shutdown();
1157        // Safety: drops once, never accessed again
1158        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1159    }
1160}
1161
1162impl fidl::endpoints::Responder for LauncherExploreComponentOverSocketResponder {
1163    type ControlHandle = LauncherControlHandle;
1164
1165    fn control_handle(&self) -> &LauncherControlHandle {
1166        &self.control_handle
1167    }
1168
1169    fn drop_without_shutdown(mut self) {
1170        // Safety: drops once, never accessed again due to mem::forget
1171        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1172        // Prevent Drop from running (which would shut down the channel)
1173        std::mem::forget(self);
1174    }
1175}
1176
1177impl LauncherExploreComponentOverSocketResponder {
1178    /// Sends a response to the FIDL transaction.
1179    ///
1180    /// Sets the channel to shutdown if an error occurs.
1181    pub fn send(self, mut result: Result<(), LauncherError>) -> Result<(), fidl::Error> {
1182        let _result = self.send_raw(result);
1183        if _result.is_err() {
1184            self.control_handle.shutdown();
1185        }
1186        self.drop_without_shutdown();
1187        _result
1188    }
1189
1190    /// Similar to "send" but does not shutdown the channel if an error occurs.
1191    pub fn send_no_shutdown_on_err(
1192        self,
1193        mut result: Result<(), LauncherError>,
1194    ) -> Result<(), fidl::Error> {
1195        let _result = self.send_raw(result);
1196        self.drop_without_shutdown();
1197        _result
1198    }
1199
1200    fn send_raw(&self, mut result: Result<(), LauncherError>) -> Result<(), fidl::Error> {
1201        self.control_handle.inner.send::<fidl::encoding::ResultType<
1202            fidl::encoding::EmptyStruct,
1203            LauncherError,
1204        >>(
1205            result,
1206            self.tx_id,
1207            0x233557fb2b70eb68,
1208            fidl::encoding::DynamicFlags::empty(),
1209        )
1210    }
1211}
1212
1213#[must_use = "FIDL methods require a response to be sent"]
1214#[derive(Debug)]
1215pub struct LauncherExplorePackageOverSocketResponder {
1216    control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
1217    tx_id: u32,
1218}
1219
1220/// Set the the channel to be shutdown (see [`LauncherControlHandle::shutdown`])
1221/// if the responder is dropped without sending a response, so that the client
1222/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1223impl std::ops::Drop for LauncherExplorePackageOverSocketResponder {
1224    fn drop(&mut self) {
1225        self.control_handle.shutdown();
1226        // Safety: drops once, never accessed again
1227        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1228    }
1229}
1230
1231impl fidl::endpoints::Responder for LauncherExplorePackageOverSocketResponder {
1232    type ControlHandle = LauncherControlHandle;
1233
1234    fn control_handle(&self) -> &LauncherControlHandle {
1235        &self.control_handle
1236    }
1237
1238    fn drop_without_shutdown(mut self) {
1239        // Safety: drops once, never accessed again due to mem::forget
1240        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1241        // Prevent Drop from running (which would shut down the channel)
1242        std::mem::forget(self);
1243    }
1244}
1245
1246impl LauncherExplorePackageOverSocketResponder {
1247    /// Sends a response to the FIDL transaction.
1248    ///
1249    /// Sets the channel to shutdown if an error occurs.
1250    pub fn send(self, mut result: Result<(), LauncherError>) -> Result<(), fidl::Error> {
1251        let _result = self.send_raw(result);
1252        if _result.is_err() {
1253            self.control_handle.shutdown();
1254        }
1255        self.drop_without_shutdown();
1256        _result
1257    }
1258
1259    /// Similar to "send" but does not shutdown the channel if an error occurs.
1260    pub fn send_no_shutdown_on_err(
1261        self,
1262        mut result: Result<(), LauncherError>,
1263    ) -> Result<(), fidl::Error> {
1264        let _result = self.send_raw(result);
1265        self.drop_without_shutdown();
1266        _result
1267    }
1268
1269    fn send_raw(&self, mut result: Result<(), LauncherError>) -> Result<(), fidl::Error> {
1270        self.control_handle.inner.send::<fidl::encoding::ResultType<
1271            fidl::encoding::EmptyStruct,
1272            LauncherError,
1273        >>(
1274            result,
1275            self.tx_id,
1276            0x8e536067655b5a2,
1277            fidl::encoding::DynamicFlags::empty(),
1278        )
1279    }
1280}
1281
1282#[must_use = "FIDL methods require a response to be sent"]
1283#[derive(Debug)]
1284pub struct LauncherExplorePackageOverSocket2Responder {
1285    control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
1286    tx_id: u32,
1287}
1288
1289/// Set the the channel to be shutdown (see [`LauncherControlHandle::shutdown`])
1290/// if the responder is dropped without sending a response, so that the client
1291/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1292impl std::ops::Drop for LauncherExplorePackageOverSocket2Responder {
1293    fn drop(&mut self) {
1294        self.control_handle.shutdown();
1295        // Safety: drops once, never accessed again
1296        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1297    }
1298}
1299
1300impl fidl::endpoints::Responder for LauncherExplorePackageOverSocket2Responder {
1301    type ControlHandle = LauncherControlHandle;
1302
1303    fn control_handle(&self) -> &LauncherControlHandle {
1304        &self.control_handle
1305    }
1306
1307    fn drop_without_shutdown(mut self) {
1308        // Safety: drops once, never accessed again due to mem::forget
1309        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1310        // Prevent Drop from running (which would shut down the channel)
1311        std::mem::forget(self);
1312    }
1313}
1314
1315impl LauncherExplorePackageOverSocket2Responder {
1316    /// Sends a response to the FIDL transaction.
1317    ///
1318    /// Sets the channel to shutdown if an error occurs.
1319    pub fn send(self, mut result: Result<(), LauncherError>) -> Result<(), fidl::Error> {
1320        let _result = self.send_raw(result);
1321        if _result.is_err() {
1322            self.control_handle.shutdown();
1323        }
1324        self.drop_without_shutdown();
1325        _result
1326    }
1327
1328    /// Similar to "send" but does not shutdown the channel if an error occurs.
1329    pub fn send_no_shutdown_on_err(
1330        self,
1331        mut result: Result<(), LauncherError>,
1332    ) -> Result<(), fidl::Error> {
1333        let _result = self.send_raw(result);
1334        self.drop_without_shutdown();
1335        _result
1336    }
1337
1338    fn send_raw(&self, mut result: Result<(), LauncherError>) -> Result<(), fidl::Error> {
1339        self.control_handle.inner.send::<fidl::encoding::ResultType<
1340            fidl::encoding::EmptyStruct,
1341            LauncherError,
1342        >>(
1343            result,
1344            self.tx_id,
1345            0x3884e07c1fa8d20b,
1346            fidl::encoding::DynamicFlags::empty(),
1347        )
1348    }
1349}
1350
1351mod internal {
1352    use super::*;
1353
1354    impl fidl::encoding::ResourceTypeMarker for LauncherExploreComponentOverPtyRequest {
1355        type Borrowed<'a> = &'a mut Self;
1356        fn take_or_borrow<'a>(
1357            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1358        ) -> Self::Borrowed<'a> {
1359            value
1360        }
1361    }
1362
1363    unsafe impl fidl::encoding::TypeMarker for LauncherExploreComponentOverPtyRequest {
1364        type Owned = Self;
1365
1366        #[inline(always)]
1367        fn inline_align(_context: fidl::encoding::Context) -> usize {
1368            8
1369        }
1370
1371        #[inline(always)]
1372        fn inline_size(_context: fidl::encoding::Context) -> usize {
1373            64
1374        }
1375    }
1376
1377    unsafe impl
1378        fidl::encoding::Encode<
1379            LauncherExploreComponentOverPtyRequest,
1380            fidl::encoding::DefaultFuchsiaResourceDialect,
1381        > for &mut LauncherExploreComponentOverPtyRequest
1382    {
1383        #[inline]
1384        unsafe fn encode(
1385            self,
1386            encoder: &mut fidl::encoding::Encoder<
1387                '_,
1388                fidl::encoding::DefaultFuchsiaResourceDialect,
1389            >,
1390            offset: usize,
1391            _depth: fidl::encoding::Depth,
1392        ) -> fidl::Result<()> {
1393            encoder.debug_check_bounds::<LauncherExploreComponentOverPtyRequest>(offset);
1394            // Delegate to tuple encoding.
1395            fidl::encoding::Encode::<LauncherExploreComponentOverPtyRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1396                (
1397                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.moniker),
1398                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_pty::DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.pty),
1399                    <fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20> as fidl::encoding::ValueTypeMarker>::borrow(&self.tool_urls),
1400                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.command),
1401                    <DashNamespaceLayout as fidl::encoding::ValueTypeMarker>::borrow(&self.ns_layout),
1402                ),
1403                encoder, offset, _depth
1404            )
1405        }
1406    }
1407    unsafe impl<
1408        T0: fidl::encoding::Encode<
1409                fidl::encoding::UnboundedString,
1410                fidl::encoding::DefaultFuchsiaResourceDialect,
1411            >,
1412        T1: fidl::encoding::Encode<
1413                fidl::encoding::Endpoint<
1414                    fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
1415                >,
1416                fidl::encoding::DefaultFuchsiaResourceDialect,
1417            >,
1418        T2: fidl::encoding::Encode<
1419                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
1420                fidl::encoding::DefaultFuchsiaResourceDialect,
1421            >,
1422        T3: fidl::encoding::Encode<
1423                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1424                fidl::encoding::DefaultFuchsiaResourceDialect,
1425            >,
1426        T4: fidl::encoding::Encode<DashNamespaceLayout, fidl::encoding::DefaultFuchsiaResourceDialect>,
1427    >
1428        fidl::encoding::Encode<
1429            LauncherExploreComponentOverPtyRequest,
1430            fidl::encoding::DefaultFuchsiaResourceDialect,
1431        > for (T0, T1, T2, T3, T4)
1432    {
1433        #[inline]
1434        unsafe fn encode(
1435            self,
1436            encoder: &mut fidl::encoding::Encoder<
1437                '_,
1438                fidl::encoding::DefaultFuchsiaResourceDialect,
1439            >,
1440            offset: usize,
1441            depth: fidl::encoding::Depth,
1442        ) -> fidl::Result<()> {
1443            encoder.debug_check_bounds::<LauncherExploreComponentOverPtyRequest>(offset);
1444            // Zero out padding regions. There's no need to apply masks
1445            // because the unmasked parts will be overwritten by fields.
1446            unsafe {
1447                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1448                (ptr as *mut u64).write_unaligned(0);
1449            }
1450            unsafe {
1451                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(56);
1452                (ptr as *mut u64).write_unaligned(0);
1453            }
1454            // Write the fields.
1455            self.0.encode(encoder, offset + 0, depth)?;
1456            self.1.encode(encoder, offset + 16, depth)?;
1457            self.2.encode(encoder, offset + 24, depth)?;
1458            self.3.encode(encoder, offset + 40, depth)?;
1459            self.4.encode(encoder, offset + 56, depth)?;
1460            Ok(())
1461        }
1462    }
1463
1464    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1465        for LauncherExploreComponentOverPtyRequest
1466    {
1467        #[inline(always)]
1468        fn new_empty() -> Self {
1469            Self {
1470                moniker: fidl::new_empty!(
1471                    fidl::encoding::UnboundedString,
1472                    fidl::encoding::DefaultFuchsiaResourceDialect
1473                ),
1474                pty: fidl::new_empty!(
1475                    fidl::encoding::Endpoint<
1476                        fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
1477                    >,
1478                    fidl::encoding::DefaultFuchsiaResourceDialect
1479                ),
1480                tool_urls: fidl::new_empty!(
1481                    fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
1482                    fidl::encoding::DefaultFuchsiaResourceDialect
1483                ),
1484                command: fidl::new_empty!(
1485                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1486                    fidl::encoding::DefaultFuchsiaResourceDialect
1487                ),
1488                ns_layout: fidl::new_empty!(
1489                    DashNamespaceLayout,
1490                    fidl::encoding::DefaultFuchsiaResourceDialect
1491                ),
1492            }
1493        }
1494
1495        #[inline]
1496        unsafe fn decode(
1497            &mut self,
1498            decoder: &mut fidl::encoding::Decoder<
1499                '_,
1500                fidl::encoding::DefaultFuchsiaResourceDialect,
1501            >,
1502            offset: usize,
1503            _depth: fidl::encoding::Depth,
1504        ) -> fidl::Result<()> {
1505            decoder.debug_check_bounds::<Self>(offset);
1506            // Verify that padding bytes are zero.
1507            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1508            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1509            let mask = 0xffffffff00000000u64;
1510            let maskedval = padval & mask;
1511            if maskedval != 0 {
1512                return Err(fidl::Error::NonZeroPadding {
1513                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1514                });
1515            }
1516            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(56) };
1517            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1518            let mask = 0xffffffff00000000u64;
1519            let maskedval = padval & mask;
1520            if maskedval != 0 {
1521                return Err(fidl::Error::NonZeroPadding {
1522                    padding_start: offset + 56 + ((mask as u64).trailing_zeros() / 8) as usize,
1523                });
1524            }
1525            fidl::decode!(
1526                fidl::encoding::UnboundedString,
1527                fidl::encoding::DefaultFuchsiaResourceDialect,
1528                &mut self.moniker,
1529                decoder,
1530                offset + 0,
1531                _depth
1532            )?;
1533            fidl::decode!(
1534                fidl::encoding::Endpoint<
1535                    fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
1536                >,
1537                fidl::encoding::DefaultFuchsiaResourceDialect,
1538                &mut self.pty,
1539                decoder,
1540                offset + 16,
1541                _depth
1542            )?;
1543            fidl::decode!(
1544                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
1545                fidl::encoding::DefaultFuchsiaResourceDialect,
1546                &mut self.tool_urls,
1547                decoder,
1548                offset + 24,
1549                _depth
1550            )?;
1551            fidl::decode!(
1552                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1553                fidl::encoding::DefaultFuchsiaResourceDialect,
1554                &mut self.command,
1555                decoder,
1556                offset + 40,
1557                _depth
1558            )?;
1559            fidl::decode!(
1560                DashNamespaceLayout,
1561                fidl::encoding::DefaultFuchsiaResourceDialect,
1562                &mut self.ns_layout,
1563                decoder,
1564                offset + 56,
1565                _depth
1566            )?;
1567            Ok(())
1568        }
1569    }
1570
1571    impl fidl::encoding::ResourceTypeMarker for LauncherExploreComponentOverSocketRequest {
1572        type Borrowed<'a> = &'a mut Self;
1573        fn take_or_borrow<'a>(
1574            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1575        ) -> Self::Borrowed<'a> {
1576            value
1577        }
1578    }
1579
1580    unsafe impl fidl::encoding::TypeMarker for LauncherExploreComponentOverSocketRequest {
1581        type Owned = Self;
1582
1583        #[inline(always)]
1584        fn inline_align(_context: fidl::encoding::Context) -> usize {
1585            8
1586        }
1587
1588        #[inline(always)]
1589        fn inline_size(_context: fidl::encoding::Context) -> usize {
1590            64
1591        }
1592    }
1593
1594    unsafe impl
1595        fidl::encoding::Encode<
1596            LauncherExploreComponentOverSocketRequest,
1597            fidl::encoding::DefaultFuchsiaResourceDialect,
1598        > for &mut LauncherExploreComponentOverSocketRequest
1599    {
1600        #[inline]
1601        unsafe fn encode(
1602            self,
1603            encoder: &mut fidl::encoding::Encoder<
1604                '_,
1605                fidl::encoding::DefaultFuchsiaResourceDialect,
1606            >,
1607            offset: usize,
1608            _depth: fidl::encoding::Depth,
1609        ) -> fidl::Result<()> {
1610            encoder.debug_check_bounds::<LauncherExploreComponentOverSocketRequest>(offset);
1611            // Delegate to tuple encoding.
1612            fidl::encoding::Encode::<LauncherExploreComponentOverSocketRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1613                (
1614                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.moniker),
1615                    <fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.socket),
1616                    <fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20> as fidl::encoding::ValueTypeMarker>::borrow(&self.tool_urls),
1617                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.command),
1618                    <DashNamespaceLayout as fidl::encoding::ValueTypeMarker>::borrow(&self.ns_layout),
1619                ),
1620                encoder, offset, _depth
1621            )
1622        }
1623    }
1624    unsafe impl<
1625        T0: fidl::encoding::Encode<
1626                fidl::encoding::UnboundedString,
1627                fidl::encoding::DefaultFuchsiaResourceDialect,
1628            >,
1629        T1: fidl::encoding::Encode<
1630                fidl::encoding::HandleType<
1631                    fidl::Socket,
1632                    { fidl::ObjectType::SOCKET.into_raw() },
1633                    2147483648,
1634                >,
1635                fidl::encoding::DefaultFuchsiaResourceDialect,
1636            >,
1637        T2: fidl::encoding::Encode<
1638                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
1639                fidl::encoding::DefaultFuchsiaResourceDialect,
1640            >,
1641        T3: fidl::encoding::Encode<
1642                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1643                fidl::encoding::DefaultFuchsiaResourceDialect,
1644            >,
1645        T4: fidl::encoding::Encode<DashNamespaceLayout, fidl::encoding::DefaultFuchsiaResourceDialect>,
1646    >
1647        fidl::encoding::Encode<
1648            LauncherExploreComponentOverSocketRequest,
1649            fidl::encoding::DefaultFuchsiaResourceDialect,
1650        > for (T0, T1, T2, T3, T4)
1651    {
1652        #[inline]
1653        unsafe fn encode(
1654            self,
1655            encoder: &mut fidl::encoding::Encoder<
1656                '_,
1657                fidl::encoding::DefaultFuchsiaResourceDialect,
1658            >,
1659            offset: usize,
1660            depth: fidl::encoding::Depth,
1661        ) -> fidl::Result<()> {
1662            encoder.debug_check_bounds::<LauncherExploreComponentOverSocketRequest>(offset);
1663            // Zero out padding regions. There's no need to apply masks
1664            // because the unmasked parts will be overwritten by fields.
1665            unsafe {
1666                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1667                (ptr as *mut u64).write_unaligned(0);
1668            }
1669            unsafe {
1670                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(56);
1671                (ptr as *mut u64).write_unaligned(0);
1672            }
1673            // Write the fields.
1674            self.0.encode(encoder, offset + 0, depth)?;
1675            self.1.encode(encoder, offset + 16, depth)?;
1676            self.2.encode(encoder, offset + 24, depth)?;
1677            self.3.encode(encoder, offset + 40, depth)?;
1678            self.4.encode(encoder, offset + 56, depth)?;
1679            Ok(())
1680        }
1681    }
1682
1683    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1684        for LauncherExploreComponentOverSocketRequest
1685    {
1686        #[inline(always)]
1687        fn new_empty() -> Self {
1688            Self {
1689                moniker: fidl::new_empty!(
1690                    fidl::encoding::UnboundedString,
1691                    fidl::encoding::DefaultFuchsiaResourceDialect
1692                ),
1693                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1694                tool_urls: fidl::new_empty!(
1695                    fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
1696                    fidl::encoding::DefaultFuchsiaResourceDialect
1697                ),
1698                command: fidl::new_empty!(
1699                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1700                    fidl::encoding::DefaultFuchsiaResourceDialect
1701                ),
1702                ns_layout: fidl::new_empty!(
1703                    DashNamespaceLayout,
1704                    fidl::encoding::DefaultFuchsiaResourceDialect
1705                ),
1706            }
1707        }
1708
1709        #[inline]
1710        unsafe fn decode(
1711            &mut self,
1712            decoder: &mut fidl::encoding::Decoder<
1713                '_,
1714                fidl::encoding::DefaultFuchsiaResourceDialect,
1715            >,
1716            offset: usize,
1717            _depth: fidl::encoding::Depth,
1718        ) -> fidl::Result<()> {
1719            decoder.debug_check_bounds::<Self>(offset);
1720            // Verify that padding bytes are zero.
1721            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1722            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1723            let mask = 0xffffffff00000000u64;
1724            let maskedval = padval & mask;
1725            if maskedval != 0 {
1726                return Err(fidl::Error::NonZeroPadding {
1727                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1728                });
1729            }
1730            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(56) };
1731            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1732            let mask = 0xffffffff00000000u64;
1733            let maskedval = padval & mask;
1734            if maskedval != 0 {
1735                return Err(fidl::Error::NonZeroPadding {
1736                    padding_start: offset + 56 + ((mask as u64).trailing_zeros() / 8) as usize,
1737                });
1738            }
1739            fidl::decode!(
1740                fidl::encoding::UnboundedString,
1741                fidl::encoding::DefaultFuchsiaResourceDialect,
1742                &mut self.moniker,
1743                decoder,
1744                offset + 0,
1745                _depth
1746            )?;
1747            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 16, _depth)?;
1748            fidl::decode!(
1749                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
1750                fidl::encoding::DefaultFuchsiaResourceDialect,
1751                &mut self.tool_urls,
1752                decoder,
1753                offset + 24,
1754                _depth
1755            )?;
1756            fidl::decode!(
1757                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1758                fidl::encoding::DefaultFuchsiaResourceDialect,
1759                &mut self.command,
1760                decoder,
1761                offset + 40,
1762                _depth
1763            )?;
1764            fidl::decode!(
1765                DashNamespaceLayout,
1766                fidl::encoding::DefaultFuchsiaResourceDialect,
1767                &mut self.ns_layout,
1768                decoder,
1769                offset + 56,
1770                _depth
1771            )?;
1772            Ok(())
1773        }
1774    }
1775
1776    impl fidl::encoding::ResourceTypeMarker for LauncherExplorePackageOverSocket2Request {
1777        type Borrowed<'a> = &'a mut Self;
1778        fn take_or_borrow<'a>(
1779            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1780        ) -> Self::Borrowed<'a> {
1781            value
1782        }
1783    }
1784
1785    unsafe impl fidl::encoding::TypeMarker for LauncherExplorePackageOverSocket2Request {
1786        type Owned = Self;
1787
1788        #[inline(always)]
1789        fn inline_align(_context: fidl::encoding::Context) -> usize {
1790            8
1791        }
1792
1793        #[inline(always)]
1794        fn inline_size(_context: fidl::encoding::Context) -> usize {
1795            80
1796        }
1797    }
1798
1799    unsafe impl
1800        fidl::encoding::Encode<
1801            LauncherExplorePackageOverSocket2Request,
1802            fidl::encoding::DefaultFuchsiaResourceDialect,
1803        > for &mut LauncherExplorePackageOverSocket2Request
1804    {
1805        #[inline]
1806        unsafe fn encode(
1807            self,
1808            encoder: &mut fidl::encoding::Encoder<
1809                '_,
1810                fidl::encoding::DefaultFuchsiaResourceDialect,
1811            >,
1812            offset: usize,
1813            _depth: fidl::encoding::Depth,
1814        ) -> fidl::Result<()> {
1815            encoder.debug_check_bounds::<LauncherExplorePackageOverSocket2Request>(offset);
1816            // Delegate to tuple encoding.
1817            fidl::encoding::Encode::<LauncherExplorePackageOverSocket2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1818                (
1819                    <FuchsiaPkgResolver as fidl::encoding::ValueTypeMarker>::borrow(&self.fuchsia_pkg_resolver),
1820                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
1821                    <fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.subpackages),
1822                    <fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.socket),
1823                    <fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20> as fidl::encoding::ValueTypeMarker>::borrow(&self.tool_urls),
1824                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.command),
1825                ),
1826                encoder, offset, _depth
1827            )
1828        }
1829    }
1830    unsafe impl<
1831        T0: fidl::encoding::Encode<FuchsiaPkgResolver, fidl::encoding::DefaultFuchsiaResourceDialect>,
1832        T1: fidl::encoding::Encode<
1833                fidl::encoding::UnboundedString,
1834                fidl::encoding::DefaultFuchsiaResourceDialect,
1835            >,
1836        T2: fidl::encoding::Encode<
1837                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1838                fidl::encoding::DefaultFuchsiaResourceDialect,
1839            >,
1840        T3: fidl::encoding::Encode<
1841                fidl::encoding::HandleType<
1842                    fidl::Socket,
1843                    { fidl::ObjectType::SOCKET.into_raw() },
1844                    2147483648,
1845                >,
1846                fidl::encoding::DefaultFuchsiaResourceDialect,
1847            >,
1848        T4: fidl::encoding::Encode<
1849                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
1850                fidl::encoding::DefaultFuchsiaResourceDialect,
1851            >,
1852        T5: fidl::encoding::Encode<
1853                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1854                fidl::encoding::DefaultFuchsiaResourceDialect,
1855            >,
1856    >
1857        fidl::encoding::Encode<
1858            LauncherExplorePackageOverSocket2Request,
1859            fidl::encoding::DefaultFuchsiaResourceDialect,
1860        > for (T0, T1, T2, T3, T4, T5)
1861    {
1862        #[inline]
1863        unsafe fn encode(
1864            self,
1865            encoder: &mut fidl::encoding::Encoder<
1866                '_,
1867                fidl::encoding::DefaultFuchsiaResourceDialect,
1868            >,
1869            offset: usize,
1870            depth: fidl::encoding::Depth,
1871        ) -> fidl::Result<()> {
1872            encoder.debug_check_bounds::<LauncherExplorePackageOverSocket2Request>(offset);
1873            // Zero out padding regions. There's no need to apply masks
1874            // because the unmasked parts will be overwritten by fields.
1875            unsafe {
1876                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1877                (ptr as *mut u64).write_unaligned(0);
1878            }
1879            unsafe {
1880                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
1881                (ptr as *mut u64).write_unaligned(0);
1882            }
1883            // Write the fields.
1884            self.0.encode(encoder, offset + 0, depth)?;
1885            self.1.encode(encoder, offset + 8, depth)?;
1886            self.2.encode(encoder, offset + 24, depth)?;
1887            self.3.encode(encoder, offset + 40, depth)?;
1888            self.4.encode(encoder, offset + 48, depth)?;
1889            self.5.encode(encoder, offset + 64, depth)?;
1890            Ok(())
1891        }
1892    }
1893
1894    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1895        for LauncherExplorePackageOverSocket2Request
1896    {
1897        #[inline(always)]
1898        fn new_empty() -> Self {
1899            Self {
1900                fuchsia_pkg_resolver: fidl::new_empty!(
1901                    FuchsiaPkgResolver,
1902                    fidl::encoding::DefaultFuchsiaResourceDialect
1903                ),
1904                url: fidl::new_empty!(
1905                    fidl::encoding::UnboundedString,
1906                    fidl::encoding::DefaultFuchsiaResourceDialect
1907                ),
1908                subpackages: fidl::new_empty!(
1909                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1910                    fidl::encoding::DefaultFuchsiaResourceDialect
1911                ),
1912                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1913                tool_urls: fidl::new_empty!(
1914                    fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
1915                    fidl::encoding::DefaultFuchsiaResourceDialect
1916                ),
1917                command: fidl::new_empty!(
1918                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1919                    fidl::encoding::DefaultFuchsiaResourceDialect
1920                ),
1921            }
1922        }
1923
1924        #[inline]
1925        unsafe fn decode(
1926            &mut self,
1927            decoder: &mut fidl::encoding::Decoder<
1928                '_,
1929                fidl::encoding::DefaultFuchsiaResourceDialect,
1930            >,
1931            offset: usize,
1932            _depth: fidl::encoding::Depth,
1933        ) -> fidl::Result<()> {
1934            decoder.debug_check_bounds::<Self>(offset);
1935            // Verify that padding bytes are zero.
1936            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1937            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1938            let mask = 0xffffffff00000000u64;
1939            let maskedval = padval & mask;
1940            if maskedval != 0 {
1941                return Err(fidl::Error::NonZeroPadding {
1942                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1943                });
1944            }
1945            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
1946            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1947            let mask = 0xffffffff00000000u64;
1948            let maskedval = padval & mask;
1949            if maskedval != 0 {
1950                return Err(fidl::Error::NonZeroPadding {
1951                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
1952                });
1953            }
1954            fidl::decode!(
1955                FuchsiaPkgResolver,
1956                fidl::encoding::DefaultFuchsiaResourceDialect,
1957                &mut self.fuchsia_pkg_resolver,
1958                decoder,
1959                offset + 0,
1960                _depth
1961            )?;
1962            fidl::decode!(
1963                fidl::encoding::UnboundedString,
1964                fidl::encoding::DefaultFuchsiaResourceDialect,
1965                &mut self.url,
1966                decoder,
1967                offset + 8,
1968                _depth
1969            )?;
1970            fidl::decode!(
1971                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1972                fidl::encoding::DefaultFuchsiaResourceDialect,
1973                &mut self.subpackages,
1974                decoder,
1975                offset + 24,
1976                _depth
1977            )?;
1978            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 40, _depth)?;
1979            fidl::decode!(
1980                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
1981                fidl::encoding::DefaultFuchsiaResourceDialect,
1982                &mut self.tool_urls,
1983                decoder,
1984                offset + 48,
1985                _depth
1986            )?;
1987            fidl::decode!(
1988                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
1989                fidl::encoding::DefaultFuchsiaResourceDialect,
1990                &mut self.command,
1991                decoder,
1992                offset + 64,
1993                _depth
1994            )?;
1995            Ok(())
1996        }
1997    }
1998
1999    impl fidl::encoding::ResourceTypeMarker for LauncherExplorePackageOverSocketRequest {
2000        type Borrowed<'a> = &'a mut Self;
2001        fn take_or_borrow<'a>(
2002            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2003        ) -> Self::Borrowed<'a> {
2004            value
2005        }
2006    }
2007
2008    unsafe impl fidl::encoding::TypeMarker for LauncherExplorePackageOverSocketRequest {
2009        type Owned = Self;
2010
2011        #[inline(always)]
2012        fn inline_align(_context: fidl::encoding::Context) -> usize {
2013            8
2014        }
2015
2016        #[inline(always)]
2017        fn inline_size(_context: fidl::encoding::Context) -> usize {
2018            72
2019        }
2020    }
2021
2022    unsafe impl
2023        fidl::encoding::Encode<
2024            LauncherExplorePackageOverSocketRequest,
2025            fidl::encoding::DefaultFuchsiaResourceDialect,
2026        > for &mut LauncherExplorePackageOverSocketRequest
2027    {
2028        #[inline]
2029        unsafe fn encode(
2030            self,
2031            encoder: &mut fidl::encoding::Encoder<
2032                '_,
2033                fidl::encoding::DefaultFuchsiaResourceDialect,
2034            >,
2035            offset: usize,
2036            _depth: fidl::encoding::Depth,
2037        ) -> fidl::Result<()> {
2038            encoder.debug_check_bounds::<LauncherExplorePackageOverSocketRequest>(offset);
2039            // Delegate to tuple encoding.
2040            fidl::encoding::Encode::<LauncherExplorePackageOverSocketRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2041                (
2042                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
2043                    <fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.subpackages),
2044                    <fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.socket),
2045                    <fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20> as fidl::encoding::ValueTypeMarker>::borrow(&self.tool_urls),
2046                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.command),
2047                ),
2048                encoder, offset, _depth
2049            )
2050        }
2051    }
2052    unsafe impl<
2053        T0: fidl::encoding::Encode<
2054                fidl::encoding::UnboundedString,
2055                fidl::encoding::DefaultFuchsiaResourceDialect,
2056            >,
2057        T1: fidl::encoding::Encode<
2058                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2059                fidl::encoding::DefaultFuchsiaResourceDialect,
2060            >,
2061        T2: fidl::encoding::Encode<
2062                fidl::encoding::HandleType<
2063                    fidl::Socket,
2064                    { fidl::ObjectType::SOCKET.into_raw() },
2065                    2147483648,
2066                >,
2067                fidl::encoding::DefaultFuchsiaResourceDialect,
2068            >,
2069        T3: fidl::encoding::Encode<
2070                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
2071                fidl::encoding::DefaultFuchsiaResourceDialect,
2072            >,
2073        T4: fidl::encoding::Encode<
2074                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
2075                fidl::encoding::DefaultFuchsiaResourceDialect,
2076            >,
2077    >
2078        fidl::encoding::Encode<
2079            LauncherExplorePackageOverSocketRequest,
2080            fidl::encoding::DefaultFuchsiaResourceDialect,
2081        > for (T0, T1, T2, T3, T4)
2082    {
2083        #[inline]
2084        unsafe fn encode(
2085            self,
2086            encoder: &mut fidl::encoding::Encoder<
2087                '_,
2088                fidl::encoding::DefaultFuchsiaResourceDialect,
2089            >,
2090            offset: usize,
2091            depth: fidl::encoding::Depth,
2092        ) -> fidl::Result<()> {
2093            encoder.debug_check_bounds::<LauncherExplorePackageOverSocketRequest>(offset);
2094            // Zero out padding regions. There's no need to apply masks
2095            // because the unmasked parts will be overwritten by fields.
2096            unsafe {
2097                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
2098                (ptr as *mut u64).write_unaligned(0);
2099            }
2100            // Write the fields.
2101            self.0.encode(encoder, offset + 0, depth)?;
2102            self.1.encode(encoder, offset + 16, depth)?;
2103            self.2.encode(encoder, offset + 32, depth)?;
2104            self.3.encode(encoder, offset + 40, depth)?;
2105            self.4.encode(encoder, offset + 56, depth)?;
2106            Ok(())
2107        }
2108    }
2109
2110    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2111        for LauncherExplorePackageOverSocketRequest
2112    {
2113        #[inline(always)]
2114        fn new_empty() -> Self {
2115            Self {
2116                url: fidl::new_empty!(
2117                    fidl::encoding::UnboundedString,
2118                    fidl::encoding::DefaultFuchsiaResourceDialect
2119                ),
2120                subpackages: fidl::new_empty!(
2121                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2122                    fidl::encoding::DefaultFuchsiaResourceDialect
2123                ),
2124                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2125                tool_urls: fidl::new_empty!(
2126                    fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
2127                    fidl::encoding::DefaultFuchsiaResourceDialect
2128                ),
2129                command: fidl::new_empty!(
2130                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
2131                    fidl::encoding::DefaultFuchsiaResourceDialect
2132                ),
2133            }
2134        }
2135
2136        #[inline]
2137        unsafe fn decode(
2138            &mut self,
2139            decoder: &mut fidl::encoding::Decoder<
2140                '_,
2141                fidl::encoding::DefaultFuchsiaResourceDialect,
2142            >,
2143            offset: usize,
2144            _depth: fidl::encoding::Depth,
2145        ) -> fidl::Result<()> {
2146            decoder.debug_check_bounds::<Self>(offset);
2147            // Verify that padding bytes are zero.
2148            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
2149            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2150            let mask = 0xffffffff00000000u64;
2151            let maskedval = padval & mask;
2152            if maskedval != 0 {
2153                return Err(fidl::Error::NonZeroPadding {
2154                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
2155                });
2156            }
2157            fidl::decode!(
2158                fidl::encoding::UnboundedString,
2159                fidl::encoding::DefaultFuchsiaResourceDialect,
2160                &mut self.url,
2161                decoder,
2162                offset + 0,
2163                _depth
2164            )?;
2165            fidl::decode!(
2166                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2167                fidl::encoding::DefaultFuchsiaResourceDialect,
2168                &mut self.subpackages,
2169                decoder,
2170                offset + 16,
2171                _depth
2172            )?;
2173            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 32, _depth)?;
2174            fidl::decode!(
2175                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 20>,
2176                fidl::encoding::DefaultFuchsiaResourceDialect,
2177                &mut self.tool_urls,
2178                decoder,
2179                offset + 40,
2180                _depth
2181            )?;
2182            fidl::decode!(
2183                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
2184                fidl::encoding::DefaultFuchsiaResourceDialect,
2185                &mut self.command,
2186                decoder,
2187                offset + 56,
2188                _depth
2189            )?;
2190            Ok(())
2191        }
2192    }
2193}