Skip to main content

fidl_fuchsia_vulkan_loader/
fidl_fuchsia_vulkan_loader.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_vulkan_loader_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct LoaderConnectToDeviceFsRequest {
16    pub channel: fidl::Channel,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for LoaderConnectToDeviceFsRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct LoaderConnectToManifestFsRequest {
26    pub options: ConnectToManifestOptions,
27    pub channel: fidl::Channel,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31    for LoaderConnectToManifestFsRequest
32{
33}
34
35#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36pub struct LoaderGetResponse {
37    pub lib: Option<fidl::Vmo>,
38}
39
40impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LoaderGetResponse {}
41
42#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
43pub struct LoaderGetVmexResourceResponse {
44    pub resource: fidl::Resource,
45}
46
47impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
48    for LoaderGetVmexResourceResponse
49{
50}
51
52#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
53pub struct LoaderMarker;
54
55impl fidl::endpoints::ProtocolMarker for LoaderMarker {
56    type Proxy = LoaderProxy;
57    type RequestStream = LoaderRequestStream;
58    #[cfg(target_os = "fuchsia")]
59    type SynchronousProxy = LoaderSynchronousProxy;
60
61    const DEBUG_NAME: &'static str = "fuchsia.vulkan.loader.Loader";
62}
63impl fidl::endpoints::DiscoverableProtocolMarker for LoaderMarker {}
64pub type LoaderGetVmexResourceResult = Result<fidl::Resource, GetVmexResourceError>;
65
66pub trait LoaderProxyInterface: Send + Sync {
67    type GetResponseFut: std::future::Future<Output = Result<Option<fidl::Vmo>, fidl::Error>> + Send;
68    fn r#get(&self, name: &str) -> Self::GetResponseFut;
69    fn r#connect_to_manifest_fs(
70        &self,
71        options: ConnectToManifestOptions,
72        channel: fidl::Channel,
73    ) -> Result<(), fidl::Error>;
74    fn r#connect_to_device_fs(&self, channel: fidl::Channel) -> Result<(), fidl::Error>;
75    type GetSupportedFeaturesResponseFut: std::future::Future<Output = Result<Features, fidl::Error>>
76        + Send;
77    fn r#get_supported_features(&self) -> Self::GetSupportedFeaturesResponseFut;
78    type GetVmexResourceResponseFut: std::future::Future<Output = Result<LoaderGetVmexResourceResult, fidl::Error>>
79        + Send;
80    fn r#get_vmex_resource(&self) -> Self::GetVmexResourceResponseFut;
81}
82#[derive(Debug)]
83#[cfg(target_os = "fuchsia")]
84pub struct LoaderSynchronousProxy {
85    client: fidl::client::sync::Client,
86}
87
88#[cfg(target_os = "fuchsia")]
89impl fidl::endpoints::SynchronousProxy for LoaderSynchronousProxy {
90    type Proxy = LoaderProxy;
91    type Protocol = LoaderMarker;
92
93    fn from_channel(inner: fidl::Channel) -> Self {
94        Self::new(inner)
95    }
96
97    fn into_channel(self) -> fidl::Channel {
98        self.client.into_channel()
99    }
100
101    fn as_channel(&self) -> &fidl::Channel {
102        self.client.as_channel()
103    }
104}
105
106#[cfg(target_os = "fuchsia")]
107impl LoaderSynchronousProxy {
108    pub fn new(channel: fidl::Channel) -> Self {
109        Self { client: fidl::client::sync::Client::new(channel) }
110    }
111
112    pub fn into_channel(self) -> fidl::Channel {
113        self.client.into_channel()
114    }
115
116    /// Waits until an event arrives and returns it. It is safe for other
117    /// threads to make concurrent requests while waiting for an event.
118    pub fn wait_for_event(
119        &self,
120        deadline: zx::MonotonicInstant,
121    ) -> Result<LoaderEvent, fidl::Error> {
122        LoaderEvent::decode(self.client.wait_for_event::<LoaderMarker>(deadline)?)
123    }
124
125    /// Requests a client driver library with the given name from the Vulkan loader
126    /// service. Returns a VMO suitable for loading as a dynamic library on
127    /// success, a null handle on failure.
128    pub fn r#get(
129        &self,
130        mut name: &str,
131        ___deadline: zx::MonotonicInstant,
132    ) -> Result<Option<fidl::Vmo>, fidl::Error> {
133        let _response =
134            self.client.send_query::<LoaderGetRequest, LoaderGetResponse, LoaderMarker>(
135                (name,),
136                0x73dbbfb62e99320a,
137                fidl::encoding::DynamicFlags::empty(),
138                ___deadline,
139            )?;
140        Ok(_response.lib)
141    }
142
143    /// Connects to a FS serving fuchsia.io containing all Vulkan ICD manifests.
144    /// See
145    /// <https://github.com/KhronosGroup/Vulkan-Loader/blob/master/loader/LoaderAndLayerInterface.md#icd-manifest-file-format>
146    /// for a description of the manifest file format.  Manifests will always
147    /// appear in this directory after the relevant device appears in
148    /// `ConnectToDeviceFs()`.
149    pub fn r#connect_to_manifest_fs(
150        &self,
151        mut options: ConnectToManifestOptions,
152        mut channel: fidl::Channel,
153    ) -> Result<(), fidl::Error> {
154        self.client.send::<LoaderConnectToManifestFsRequest>(
155            (options, channel),
156            0x454d855877881cc,
157            fidl::encoding::DynamicFlags::empty(),
158        )
159    }
160
161    /// Connects to a FS serving fuchsia.io containing all device nodes
162    /// potentially relevant to ICDs.  Trusted devices are exposed only to trusted
163    /// loader clients (see [`TrustedService`]).
164    pub fn r#connect_to_device_fs(&self, mut channel: fidl::Channel) -> Result<(), fidl::Error> {
165        self.client.send::<LoaderConnectToDeviceFsRequest>(
166            (channel,),
167            0x11cd633f2f5ff6d7,
168            fidl::encoding::DynamicFlags::empty(),
169        )
170    }
171
172    /// Returns the set of features the loader service supports.
173    pub fn r#get_supported_features(
174        &self,
175        ___deadline: zx::MonotonicInstant,
176    ) -> Result<Features, fidl::Error> {
177        let _response = self.client.send_query::<
178            fidl::encoding::EmptyPayload,
179            LoaderGetSupportedFeaturesResponse,
180            LoaderMarker,
181        >(
182            (),
183            0x381abfce172892bd,
184            fidl::encoding::DynamicFlags::empty(),
185            ___deadline,
186        )?;
187        Ok(_response.features)
188    }
189
190    /// Returns a VmexResource that can be used by Lavapipe to JIT-compile code in the client
191    /// process, or an error.
192    pub fn r#get_vmex_resource(
193        &self,
194        ___deadline: zx::MonotonicInstant,
195    ) -> Result<LoaderGetVmexResourceResult, fidl::Error> {
196        let _response =
197            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
198                LoaderGetVmexResourceResponse,
199                GetVmexResourceError,
200            >, LoaderMarker>(
201                (),
202                0x71aea090ffef259b,
203                fidl::encoding::DynamicFlags::empty(),
204                ___deadline,
205            )?;
206        Ok(_response.map(|x| x.resource))
207    }
208}
209
210#[cfg(target_os = "fuchsia")]
211impl From<LoaderSynchronousProxy> for zx::NullableHandle {
212    fn from(value: LoaderSynchronousProxy) -> Self {
213        value.into_channel().into()
214    }
215}
216
217#[cfg(target_os = "fuchsia")]
218impl From<fidl::Channel> for LoaderSynchronousProxy {
219    fn from(value: fidl::Channel) -> Self {
220        Self::new(value)
221    }
222}
223
224#[cfg(target_os = "fuchsia")]
225impl fidl::endpoints::FromClient for LoaderSynchronousProxy {
226    type Protocol = LoaderMarker;
227
228    fn from_client(value: fidl::endpoints::ClientEnd<LoaderMarker>) -> Self {
229        Self::new(value.into_channel())
230    }
231}
232
233#[derive(Debug, Clone)]
234pub struct LoaderProxy {
235    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
236}
237
238impl fidl::endpoints::Proxy for LoaderProxy {
239    type Protocol = LoaderMarker;
240
241    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
242        Self::new(inner)
243    }
244
245    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
246        self.client.into_channel().map_err(|client| Self { client })
247    }
248
249    fn as_channel(&self) -> &::fidl::AsyncChannel {
250        self.client.as_channel()
251    }
252}
253
254impl LoaderProxy {
255    /// Create a new Proxy for fuchsia.vulkan.loader/Loader.
256    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
257        let protocol_name = <LoaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
258        Self { client: fidl::client::Client::new(channel, protocol_name) }
259    }
260
261    /// Get a Stream of events from the remote end of the protocol.
262    ///
263    /// # Panics
264    ///
265    /// Panics if the event stream was already taken.
266    pub fn take_event_stream(&self) -> LoaderEventStream {
267        LoaderEventStream { event_receiver: self.client.take_event_receiver() }
268    }
269
270    /// Requests a client driver library with the given name from the Vulkan loader
271    /// service. Returns a VMO suitable for loading as a dynamic library on
272    /// success, a null handle on failure.
273    pub fn r#get(
274        &self,
275        mut name: &str,
276    ) -> fidl::client::QueryResponseFut<
277        Option<fidl::Vmo>,
278        fidl::encoding::DefaultFuchsiaResourceDialect,
279    > {
280        LoaderProxyInterface::r#get(self, name)
281    }
282
283    /// Connects to a FS serving fuchsia.io containing all Vulkan ICD manifests.
284    /// See
285    /// <https://github.com/KhronosGroup/Vulkan-Loader/blob/master/loader/LoaderAndLayerInterface.md#icd-manifest-file-format>
286    /// for a description of the manifest file format.  Manifests will always
287    /// appear in this directory after the relevant device appears in
288    /// `ConnectToDeviceFs()`.
289    pub fn r#connect_to_manifest_fs(
290        &self,
291        mut options: ConnectToManifestOptions,
292        mut channel: fidl::Channel,
293    ) -> Result<(), fidl::Error> {
294        LoaderProxyInterface::r#connect_to_manifest_fs(self, options, channel)
295    }
296
297    /// Connects to a FS serving fuchsia.io containing all device nodes
298    /// potentially relevant to ICDs.  Trusted devices are exposed only to trusted
299    /// loader clients (see [`TrustedService`]).
300    pub fn r#connect_to_device_fs(&self, mut channel: fidl::Channel) -> Result<(), fidl::Error> {
301        LoaderProxyInterface::r#connect_to_device_fs(self, channel)
302    }
303
304    /// Returns the set of features the loader service supports.
305    pub fn r#get_supported_features(
306        &self,
307    ) -> fidl::client::QueryResponseFut<Features, fidl::encoding::DefaultFuchsiaResourceDialect>
308    {
309        LoaderProxyInterface::r#get_supported_features(self)
310    }
311
312    /// Returns a VmexResource that can be used by Lavapipe to JIT-compile code in the client
313    /// process, or an error.
314    pub fn r#get_vmex_resource(
315        &self,
316    ) -> fidl::client::QueryResponseFut<
317        LoaderGetVmexResourceResult,
318        fidl::encoding::DefaultFuchsiaResourceDialect,
319    > {
320        LoaderProxyInterface::r#get_vmex_resource(self)
321    }
322}
323
324impl LoaderProxyInterface for LoaderProxy {
325    type GetResponseFut = fidl::client::QueryResponseFut<
326        Option<fidl::Vmo>,
327        fidl::encoding::DefaultFuchsiaResourceDialect,
328    >;
329    fn r#get(&self, mut name: &str) -> Self::GetResponseFut {
330        fn _decode(
331            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
332        ) -> Result<Option<fidl::Vmo>, fidl::Error> {
333            let _response = fidl::client::decode_transaction_body::<
334                LoaderGetResponse,
335                fidl::encoding::DefaultFuchsiaResourceDialect,
336                0x73dbbfb62e99320a,
337            >(_buf?)?;
338            Ok(_response.lib)
339        }
340        self.client.send_query_and_decode::<LoaderGetRequest, Option<fidl::Vmo>>(
341            (name,),
342            0x73dbbfb62e99320a,
343            fidl::encoding::DynamicFlags::empty(),
344            _decode,
345        )
346    }
347
348    fn r#connect_to_manifest_fs(
349        &self,
350        mut options: ConnectToManifestOptions,
351        mut channel: fidl::Channel,
352    ) -> Result<(), fidl::Error> {
353        self.client.send::<LoaderConnectToManifestFsRequest>(
354            (options, channel),
355            0x454d855877881cc,
356            fidl::encoding::DynamicFlags::empty(),
357        )
358    }
359
360    fn r#connect_to_device_fs(&self, mut channel: fidl::Channel) -> Result<(), fidl::Error> {
361        self.client.send::<LoaderConnectToDeviceFsRequest>(
362            (channel,),
363            0x11cd633f2f5ff6d7,
364            fidl::encoding::DynamicFlags::empty(),
365        )
366    }
367
368    type GetSupportedFeaturesResponseFut =
369        fidl::client::QueryResponseFut<Features, fidl::encoding::DefaultFuchsiaResourceDialect>;
370    fn r#get_supported_features(&self) -> Self::GetSupportedFeaturesResponseFut {
371        fn _decode(
372            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
373        ) -> Result<Features, fidl::Error> {
374            let _response = fidl::client::decode_transaction_body::<
375                LoaderGetSupportedFeaturesResponse,
376                fidl::encoding::DefaultFuchsiaResourceDialect,
377                0x381abfce172892bd,
378            >(_buf?)?;
379            Ok(_response.features)
380        }
381        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Features>(
382            (),
383            0x381abfce172892bd,
384            fidl::encoding::DynamicFlags::empty(),
385            _decode,
386        )
387    }
388
389    type GetVmexResourceResponseFut = fidl::client::QueryResponseFut<
390        LoaderGetVmexResourceResult,
391        fidl::encoding::DefaultFuchsiaResourceDialect,
392    >;
393    fn r#get_vmex_resource(&self) -> Self::GetVmexResourceResponseFut {
394        fn _decode(
395            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
396        ) -> Result<LoaderGetVmexResourceResult, fidl::Error> {
397            let _response = fidl::client::decode_transaction_body::<
398                fidl::encoding::ResultType<LoaderGetVmexResourceResponse, GetVmexResourceError>,
399                fidl::encoding::DefaultFuchsiaResourceDialect,
400                0x71aea090ffef259b,
401            >(_buf?)?;
402            Ok(_response.map(|x| x.resource))
403        }
404        self.client
405            .send_query_and_decode::<fidl::encoding::EmptyPayload, LoaderGetVmexResourceResult>(
406                (),
407                0x71aea090ffef259b,
408                fidl::encoding::DynamicFlags::empty(),
409                _decode,
410            )
411    }
412}
413
414pub struct LoaderEventStream {
415    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
416}
417
418impl std::marker::Unpin for LoaderEventStream {}
419
420impl futures::stream::FusedStream for LoaderEventStream {
421    fn is_terminated(&self) -> bool {
422        self.event_receiver.is_terminated()
423    }
424}
425
426impl futures::Stream for LoaderEventStream {
427    type Item = Result<LoaderEvent, fidl::Error>;
428
429    fn poll_next(
430        mut self: std::pin::Pin<&mut Self>,
431        cx: &mut std::task::Context<'_>,
432    ) -> std::task::Poll<Option<Self::Item>> {
433        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
434            &mut self.event_receiver,
435            cx
436        )?) {
437            Some(buf) => std::task::Poll::Ready(Some(LoaderEvent::decode(buf))),
438            None => std::task::Poll::Ready(None),
439        }
440    }
441}
442
443#[derive(Debug)]
444pub enum LoaderEvent {}
445
446impl LoaderEvent {
447    /// Decodes a message buffer as a [`LoaderEvent`].
448    fn decode(
449        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
450    ) -> Result<LoaderEvent, fidl::Error> {
451        let (bytes, _handles) = buf.split_mut();
452        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
453        debug_assert_eq!(tx_header.tx_id, 0);
454        match tx_header.ordinal {
455            _ => Err(fidl::Error::UnknownOrdinal {
456                ordinal: tx_header.ordinal,
457                protocol_name: <LoaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
458            }),
459        }
460    }
461}
462
463/// A Stream of incoming requests for fuchsia.vulkan.loader/Loader.
464pub struct LoaderRequestStream {
465    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
466    is_terminated: bool,
467}
468
469impl std::marker::Unpin for LoaderRequestStream {}
470
471impl futures::stream::FusedStream for LoaderRequestStream {
472    fn is_terminated(&self) -> bool {
473        self.is_terminated
474    }
475}
476
477impl fidl::endpoints::RequestStream for LoaderRequestStream {
478    type Protocol = LoaderMarker;
479    type ControlHandle = LoaderControlHandle;
480
481    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
482        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
483    }
484
485    fn control_handle(&self) -> Self::ControlHandle {
486        LoaderControlHandle { inner: self.inner.clone() }
487    }
488
489    fn into_inner(
490        self,
491    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
492    {
493        (self.inner, self.is_terminated)
494    }
495
496    fn from_inner(
497        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
498        is_terminated: bool,
499    ) -> Self {
500        Self { inner, is_terminated }
501    }
502}
503
504impl futures::Stream for LoaderRequestStream {
505    type Item = Result<LoaderRequest, fidl::Error>;
506
507    fn poll_next(
508        mut self: std::pin::Pin<&mut Self>,
509        cx: &mut std::task::Context<'_>,
510    ) -> std::task::Poll<Option<Self::Item>> {
511        let this = &mut *self;
512        if this.inner.check_shutdown(cx) {
513            this.is_terminated = true;
514            return std::task::Poll::Ready(None);
515        }
516        if this.is_terminated {
517            panic!("polled LoaderRequestStream after completion");
518        }
519        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
520            |bytes, handles| {
521                match this.inner.channel().read_etc(cx, bytes, handles) {
522                    std::task::Poll::Ready(Ok(())) => {}
523                    std::task::Poll::Pending => return std::task::Poll::Pending,
524                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
525                        this.is_terminated = true;
526                        return std::task::Poll::Ready(None);
527                    }
528                    std::task::Poll::Ready(Err(e)) => {
529                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
530                            e.into(),
531                        ))));
532                    }
533                }
534
535                // A message has been received from the channel
536                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
537
538                std::task::Poll::Ready(Some(match header.ordinal {
539                    0x73dbbfb62e99320a => {
540                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
541                        let mut req = fidl::new_empty!(
542                            LoaderGetRequest,
543                            fidl::encoding::DefaultFuchsiaResourceDialect
544                        );
545                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LoaderGetRequest>(&header, _body_bytes, handles, &mut req)?;
546                        let control_handle = LoaderControlHandle { inner: this.inner.clone() };
547                        Ok(LoaderRequest::Get {
548                            name: req.name,
549
550                            responder: LoaderGetResponder {
551                                control_handle: std::mem::ManuallyDrop::new(control_handle),
552                                tx_id: header.tx_id,
553                            },
554                        })
555                    }
556                    0x454d855877881cc => {
557                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
558                        let mut req = fidl::new_empty!(
559                            LoaderConnectToManifestFsRequest,
560                            fidl::encoding::DefaultFuchsiaResourceDialect
561                        );
562                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LoaderConnectToManifestFsRequest>(&header, _body_bytes, handles, &mut req)?;
563                        let control_handle = LoaderControlHandle { inner: this.inner.clone() };
564                        Ok(LoaderRequest::ConnectToManifestFs {
565                            options: req.options,
566                            channel: req.channel,
567
568                            control_handle,
569                        })
570                    }
571                    0x11cd633f2f5ff6d7 => {
572                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
573                        let mut req = fidl::new_empty!(
574                            LoaderConnectToDeviceFsRequest,
575                            fidl::encoding::DefaultFuchsiaResourceDialect
576                        );
577                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LoaderConnectToDeviceFsRequest>(&header, _body_bytes, handles, &mut req)?;
578                        let control_handle = LoaderControlHandle { inner: this.inner.clone() };
579                        Ok(LoaderRequest::ConnectToDeviceFs {
580                            channel: req.channel,
581
582                            control_handle,
583                        })
584                    }
585                    0x381abfce172892bd => {
586                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
587                        let mut req = fidl::new_empty!(
588                            fidl::encoding::EmptyPayload,
589                            fidl::encoding::DefaultFuchsiaResourceDialect
590                        );
591                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
592                        let control_handle = LoaderControlHandle { inner: this.inner.clone() };
593                        Ok(LoaderRequest::GetSupportedFeatures {
594                            responder: LoaderGetSupportedFeaturesResponder {
595                                control_handle: std::mem::ManuallyDrop::new(control_handle),
596                                tx_id: header.tx_id,
597                            },
598                        })
599                    }
600                    0x71aea090ffef259b => {
601                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
602                        let mut req = fidl::new_empty!(
603                            fidl::encoding::EmptyPayload,
604                            fidl::encoding::DefaultFuchsiaResourceDialect
605                        );
606                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
607                        let control_handle = LoaderControlHandle { inner: this.inner.clone() };
608                        Ok(LoaderRequest::GetVmexResource {
609                            responder: LoaderGetVmexResourceResponder {
610                                control_handle: std::mem::ManuallyDrop::new(control_handle),
611                                tx_id: header.tx_id,
612                            },
613                        })
614                    }
615                    _ => Err(fidl::Error::UnknownOrdinal {
616                        ordinal: header.ordinal,
617                        protocol_name:
618                            <LoaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
619                    }),
620                }))
621            },
622        )
623    }
624}
625
626/// Provides Vulkan ICD (installable client driver) libraries.
627/// Regular clients should access this protocol directly.
628/// Trusted clients should access this protocol using the [`TrustedService`].
629#[derive(Debug)]
630pub enum LoaderRequest {
631    /// Requests a client driver library with the given name from the Vulkan loader
632    /// service. Returns a VMO suitable for loading as a dynamic library on
633    /// success, a null handle on failure.
634    Get { name: String, responder: LoaderGetResponder },
635    /// Connects to a FS serving fuchsia.io containing all Vulkan ICD manifests.
636    /// See
637    /// <https://github.com/KhronosGroup/Vulkan-Loader/blob/master/loader/LoaderAndLayerInterface.md#icd-manifest-file-format>
638    /// for a description of the manifest file format.  Manifests will always
639    /// appear in this directory after the relevant device appears in
640    /// `ConnectToDeviceFs()`.
641    ConnectToManifestFs {
642        options: ConnectToManifestOptions,
643        channel: fidl::Channel,
644        control_handle: LoaderControlHandle,
645    },
646    /// Connects to a FS serving fuchsia.io containing all device nodes
647    /// potentially relevant to ICDs.  Trusted devices are exposed only to trusted
648    /// loader clients (see [`TrustedService`]).
649    ConnectToDeviceFs { channel: fidl::Channel, control_handle: LoaderControlHandle },
650    /// Returns the set of features the loader service supports.
651    GetSupportedFeatures { responder: LoaderGetSupportedFeaturesResponder },
652    /// Returns a VmexResource that can be used by Lavapipe to JIT-compile code in the client
653    /// process, or an error.
654    GetVmexResource { responder: LoaderGetVmexResourceResponder },
655}
656
657impl LoaderRequest {
658    #[allow(irrefutable_let_patterns)]
659    pub fn into_get(self) -> Option<(String, LoaderGetResponder)> {
660        if let LoaderRequest::Get { name, responder } = self {
661            Some((name, responder))
662        } else {
663            None
664        }
665    }
666
667    #[allow(irrefutable_let_patterns)]
668    pub fn into_connect_to_manifest_fs(
669        self,
670    ) -> Option<(ConnectToManifestOptions, fidl::Channel, LoaderControlHandle)> {
671        if let LoaderRequest::ConnectToManifestFs { options, channel, control_handle } = self {
672            Some((options, channel, control_handle))
673        } else {
674            None
675        }
676    }
677
678    #[allow(irrefutable_let_patterns)]
679    pub fn into_connect_to_device_fs(self) -> Option<(fidl::Channel, LoaderControlHandle)> {
680        if let LoaderRequest::ConnectToDeviceFs { channel, control_handle } = self {
681            Some((channel, control_handle))
682        } else {
683            None
684        }
685    }
686
687    #[allow(irrefutable_let_patterns)]
688    pub fn into_get_supported_features(self) -> Option<(LoaderGetSupportedFeaturesResponder)> {
689        if let LoaderRequest::GetSupportedFeatures { responder } = self {
690            Some((responder))
691        } else {
692            None
693        }
694    }
695
696    #[allow(irrefutable_let_patterns)]
697    pub fn into_get_vmex_resource(self) -> Option<(LoaderGetVmexResourceResponder)> {
698        if let LoaderRequest::GetVmexResource { responder } = self {
699            Some((responder))
700        } else {
701            None
702        }
703    }
704
705    /// Name of the method defined in FIDL
706    pub fn method_name(&self) -> &'static str {
707        match *self {
708            LoaderRequest::Get { .. } => "get",
709            LoaderRequest::ConnectToManifestFs { .. } => "connect_to_manifest_fs",
710            LoaderRequest::ConnectToDeviceFs { .. } => "connect_to_device_fs",
711            LoaderRequest::GetSupportedFeatures { .. } => "get_supported_features",
712            LoaderRequest::GetVmexResource { .. } => "get_vmex_resource",
713        }
714    }
715}
716
717#[derive(Debug, Clone)]
718pub struct LoaderControlHandle {
719    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
720}
721
722impl LoaderControlHandle {
723    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
724        self.inner.shutdown_with_epitaph(status.into())
725    }
726}
727
728impl fidl::endpoints::ControlHandle for LoaderControlHandle {
729    fn shutdown(&self) {
730        self.inner.shutdown()
731    }
732
733    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
734        self.inner.shutdown_with_epitaph(status)
735    }
736
737    fn is_closed(&self) -> bool {
738        self.inner.channel().is_closed()
739    }
740    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
741        self.inner.channel().on_closed()
742    }
743
744    #[cfg(target_os = "fuchsia")]
745    fn signal_peer(
746        &self,
747        clear_mask: zx::Signals,
748        set_mask: zx::Signals,
749    ) -> Result<(), zx_status::Status> {
750        use fidl::Peered;
751        self.inner.channel().signal_peer(clear_mask, set_mask)
752    }
753}
754
755impl LoaderControlHandle {}
756
757#[must_use = "FIDL methods require a response to be sent"]
758#[derive(Debug)]
759pub struct LoaderGetResponder {
760    control_handle: std::mem::ManuallyDrop<LoaderControlHandle>,
761    tx_id: u32,
762}
763
764/// Set the the channel to be shutdown (see [`LoaderControlHandle::shutdown`])
765/// if the responder is dropped without sending a response, so that the client
766/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
767impl std::ops::Drop for LoaderGetResponder {
768    fn drop(&mut self) {
769        self.control_handle.shutdown();
770        // Safety: drops once, never accessed again
771        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
772    }
773}
774
775impl fidl::endpoints::Responder for LoaderGetResponder {
776    type ControlHandle = LoaderControlHandle;
777
778    fn control_handle(&self) -> &LoaderControlHandle {
779        &self.control_handle
780    }
781
782    fn drop_without_shutdown(mut self) {
783        // Safety: drops once, never accessed again due to mem::forget
784        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
785        // Prevent Drop from running (which would shut down the channel)
786        std::mem::forget(self);
787    }
788}
789
790impl LoaderGetResponder {
791    /// Sends a response to the FIDL transaction.
792    ///
793    /// Sets the channel to shutdown if an error occurs.
794    pub fn send(self, mut lib: Option<fidl::Vmo>) -> Result<(), fidl::Error> {
795        let _result = self.send_raw(lib);
796        if _result.is_err() {
797            self.control_handle.shutdown();
798        }
799        self.drop_without_shutdown();
800        _result
801    }
802
803    /// Similar to "send" but does not shutdown the channel if an error occurs.
804    pub fn send_no_shutdown_on_err(self, mut lib: Option<fidl::Vmo>) -> Result<(), fidl::Error> {
805        let _result = self.send_raw(lib);
806        self.drop_without_shutdown();
807        _result
808    }
809
810    fn send_raw(&self, mut lib: Option<fidl::Vmo>) -> Result<(), fidl::Error> {
811        self.control_handle.inner.send::<LoaderGetResponse>(
812            (lib,),
813            self.tx_id,
814            0x73dbbfb62e99320a,
815            fidl::encoding::DynamicFlags::empty(),
816        )
817    }
818}
819
820#[must_use = "FIDL methods require a response to be sent"]
821#[derive(Debug)]
822pub struct LoaderGetSupportedFeaturesResponder {
823    control_handle: std::mem::ManuallyDrop<LoaderControlHandle>,
824    tx_id: u32,
825}
826
827/// Set the the channel to be shutdown (see [`LoaderControlHandle::shutdown`])
828/// if the responder is dropped without sending a response, so that the client
829/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
830impl std::ops::Drop for LoaderGetSupportedFeaturesResponder {
831    fn drop(&mut self) {
832        self.control_handle.shutdown();
833        // Safety: drops once, never accessed again
834        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
835    }
836}
837
838impl fidl::endpoints::Responder for LoaderGetSupportedFeaturesResponder {
839    type ControlHandle = LoaderControlHandle;
840
841    fn control_handle(&self) -> &LoaderControlHandle {
842        &self.control_handle
843    }
844
845    fn drop_without_shutdown(mut self) {
846        // Safety: drops once, never accessed again due to mem::forget
847        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
848        // Prevent Drop from running (which would shut down the channel)
849        std::mem::forget(self);
850    }
851}
852
853impl LoaderGetSupportedFeaturesResponder {
854    /// Sends a response to the FIDL transaction.
855    ///
856    /// Sets the channel to shutdown if an error occurs.
857    pub fn send(self, mut features: Features) -> Result<(), fidl::Error> {
858        let _result = self.send_raw(features);
859        if _result.is_err() {
860            self.control_handle.shutdown();
861        }
862        self.drop_without_shutdown();
863        _result
864    }
865
866    /// Similar to "send" but does not shutdown the channel if an error occurs.
867    pub fn send_no_shutdown_on_err(self, mut features: Features) -> Result<(), fidl::Error> {
868        let _result = self.send_raw(features);
869        self.drop_without_shutdown();
870        _result
871    }
872
873    fn send_raw(&self, mut features: Features) -> Result<(), fidl::Error> {
874        self.control_handle.inner.send::<LoaderGetSupportedFeaturesResponse>(
875            (features,),
876            self.tx_id,
877            0x381abfce172892bd,
878            fidl::encoding::DynamicFlags::empty(),
879        )
880    }
881}
882
883#[must_use = "FIDL methods require a response to be sent"]
884#[derive(Debug)]
885pub struct LoaderGetVmexResourceResponder {
886    control_handle: std::mem::ManuallyDrop<LoaderControlHandle>,
887    tx_id: u32,
888}
889
890/// Set the the channel to be shutdown (see [`LoaderControlHandle::shutdown`])
891/// if the responder is dropped without sending a response, so that the client
892/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
893impl std::ops::Drop for LoaderGetVmexResourceResponder {
894    fn drop(&mut self) {
895        self.control_handle.shutdown();
896        // Safety: drops once, never accessed again
897        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
898    }
899}
900
901impl fidl::endpoints::Responder for LoaderGetVmexResourceResponder {
902    type ControlHandle = LoaderControlHandle;
903
904    fn control_handle(&self) -> &LoaderControlHandle {
905        &self.control_handle
906    }
907
908    fn drop_without_shutdown(mut self) {
909        // Safety: drops once, never accessed again due to mem::forget
910        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
911        // Prevent Drop from running (which would shut down the channel)
912        std::mem::forget(self);
913    }
914}
915
916impl LoaderGetVmexResourceResponder {
917    /// Sends a response to the FIDL transaction.
918    ///
919    /// Sets the channel to shutdown if an error occurs.
920    pub fn send(
921        self,
922        mut result: Result<fidl::Resource, GetVmexResourceError>,
923    ) -> Result<(), fidl::Error> {
924        let _result = self.send_raw(result);
925        if _result.is_err() {
926            self.control_handle.shutdown();
927        }
928        self.drop_without_shutdown();
929        _result
930    }
931
932    /// Similar to "send" but does not shutdown the channel if an error occurs.
933    pub fn send_no_shutdown_on_err(
934        self,
935        mut result: Result<fidl::Resource, GetVmexResourceError>,
936    ) -> Result<(), fidl::Error> {
937        let _result = self.send_raw(result);
938        self.drop_without_shutdown();
939        _result
940    }
941
942    fn send_raw(
943        &self,
944        mut result: Result<fidl::Resource, GetVmexResourceError>,
945    ) -> Result<(), fidl::Error> {
946        self.control_handle.inner.send::<fidl::encoding::ResultType<
947            LoaderGetVmexResourceResponse,
948            GetVmexResourceError,
949        >>(
950            result.map(|resource| (resource,)),
951            self.tx_id,
952            0x71aea090ffef259b,
953            fidl::encoding::DynamicFlags::empty(),
954        )
955    }
956}
957
958#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
959pub struct TrustedServiceMarker;
960
961#[cfg(target_os = "fuchsia")]
962impl fidl::endpoints::ServiceMarker for TrustedServiceMarker {
963    type Proxy = TrustedServiceProxy;
964    type Request = TrustedServiceRequest;
965    const SERVICE_NAME: &'static str = "fuchsia.vulkan.loader.TrustedService";
966}
967
968/// A request for one of the member protocols of TrustedService.
969///
970/// Provides expanded device node access to trusted clients.
971#[cfg(target_os = "fuchsia")]
972pub enum TrustedServiceRequest {
973    Loader(LoaderRequestStream),
974}
975
976#[cfg(target_os = "fuchsia")]
977impl fidl::endpoints::ServiceRequest for TrustedServiceRequest {
978    type Service = TrustedServiceMarker;
979
980    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
981        match name {
982            "loader" => Self::Loader(
983                <LoaderRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
984            ),
985            _ => panic!("no such member protocol name for service TrustedService"),
986        }
987    }
988
989    fn member_names() -> &'static [&'static str] {
990        &["loader"]
991    }
992}
993/// Provides expanded device node access to trusted clients.
994#[cfg(target_os = "fuchsia")]
995pub struct TrustedServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
996
997#[cfg(target_os = "fuchsia")]
998impl fidl::endpoints::ServiceProxy for TrustedServiceProxy {
999    type Service = TrustedServiceMarker;
1000
1001    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1002        Self(opener)
1003    }
1004}
1005
1006#[cfg(target_os = "fuchsia")]
1007impl TrustedServiceProxy {
1008    pub fn connect_to_loader(&self) -> Result<LoaderProxy, fidl::Error> {
1009        let (proxy, server_end) = fidl::endpoints::create_proxy::<LoaderMarker>();
1010        self.connect_channel_to_loader(server_end)?;
1011        Ok(proxy)
1012    }
1013
1014    /// Like `connect_to_loader`, but returns a sync proxy.
1015    /// See [`Self::connect_to_loader`] for more details.
1016    pub fn connect_to_loader_sync(&self) -> Result<LoaderSynchronousProxy, fidl::Error> {
1017        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<LoaderMarker>();
1018        self.connect_channel_to_loader(server_end)?;
1019        Ok(proxy)
1020    }
1021
1022    /// Like `connect_to_loader`, but accepts a server end.
1023    /// See [`Self::connect_to_loader`] for more details.
1024    pub fn connect_channel_to_loader(
1025        &self,
1026        server_end: fidl::endpoints::ServerEnd<LoaderMarker>,
1027    ) -> Result<(), fidl::Error> {
1028        self.0.open_member("loader", server_end.into_channel())
1029    }
1030
1031    pub fn instance_name(&self) -> &str {
1032        self.0.instance_name()
1033    }
1034}
1035
1036mod internal {
1037    use super::*;
1038
1039    impl fidl::encoding::ResourceTypeMarker for LoaderConnectToDeviceFsRequest {
1040        type Borrowed<'a> = &'a mut Self;
1041        fn take_or_borrow<'a>(
1042            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1043        ) -> Self::Borrowed<'a> {
1044            value
1045        }
1046    }
1047
1048    unsafe impl fidl::encoding::TypeMarker for LoaderConnectToDeviceFsRequest {
1049        type Owned = Self;
1050
1051        #[inline(always)]
1052        fn inline_align(_context: fidl::encoding::Context) -> usize {
1053            4
1054        }
1055
1056        #[inline(always)]
1057        fn inline_size(_context: fidl::encoding::Context) -> usize {
1058            4
1059        }
1060    }
1061
1062    unsafe impl
1063        fidl::encoding::Encode<
1064            LoaderConnectToDeviceFsRequest,
1065            fidl::encoding::DefaultFuchsiaResourceDialect,
1066        > for &mut LoaderConnectToDeviceFsRequest
1067    {
1068        #[inline]
1069        unsafe fn encode(
1070            self,
1071            encoder: &mut fidl::encoding::Encoder<
1072                '_,
1073                fidl::encoding::DefaultFuchsiaResourceDialect,
1074            >,
1075            offset: usize,
1076            _depth: fidl::encoding::Depth,
1077        ) -> fidl::Result<()> {
1078            encoder.debug_check_bounds::<LoaderConnectToDeviceFsRequest>(offset);
1079            // Delegate to tuple encoding.
1080            fidl::encoding::Encode::<
1081                LoaderConnectToDeviceFsRequest,
1082                fidl::encoding::DefaultFuchsiaResourceDialect,
1083            >::encode(
1084                (<fidl::encoding::HandleType<
1085                    fidl::Channel,
1086                    { fidl::ObjectType::CHANNEL.into_raw() },
1087                    2147483648,
1088                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1089                    &mut self.channel
1090                ),),
1091                encoder,
1092                offset,
1093                _depth,
1094            )
1095        }
1096    }
1097    unsafe impl<
1098        T0: fidl::encoding::Encode<
1099                fidl::encoding::HandleType<
1100                    fidl::Channel,
1101                    { fidl::ObjectType::CHANNEL.into_raw() },
1102                    2147483648,
1103                >,
1104                fidl::encoding::DefaultFuchsiaResourceDialect,
1105            >,
1106    >
1107        fidl::encoding::Encode<
1108            LoaderConnectToDeviceFsRequest,
1109            fidl::encoding::DefaultFuchsiaResourceDialect,
1110        > for (T0,)
1111    {
1112        #[inline]
1113        unsafe fn encode(
1114            self,
1115            encoder: &mut fidl::encoding::Encoder<
1116                '_,
1117                fidl::encoding::DefaultFuchsiaResourceDialect,
1118            >,
1119            offset: usize,
1120            depth: fidl::encoding::Depth,
1121        ) -> fidl::Result<()> {
1122            encoder.debug_check_bounds::<LoaderConnectToDeviceFsRequest>(offset);
1123            // Zero out padding regions. There's no need to apply masks
1124            // because the unmasked parts will be overwritten by fields.
1125            // Write the fields.
1126            self.0.encode(encoder, offset + 0, depth)?;
1127            Ok(())
1128        }
1129    }
1130
1131    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1132        for LoaderConnectToDeviceFsRequest
1133    {
1134        #[inline(always)]
1135        fn new_empty() -> Self {
1136            Self {
1137                channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1138            }
1139        }
1140
1141        #[inline]
1142        unsafe fn decode(
1143            &mut self,
1144            decoder: &mut fidl::encoding::Decoder<
1145                '_,
1146                fidl::encoding::DefaultFuchsiaResourceDialect,
1147            >,
1148            offset: usize,
1149            _depth: fidl::encoding::Depth,
1150        ) -> fidl::Result<()> {
1151            decoder.debug_check_bounds::<Self>(offset);
1152            // Verify that padding bytes are zero.
1153            fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.channel, decoder, offset + 0, _depth)?;
1154            Ok(())
1155        }
1156    }
1157
1158    impl fidl::encoding::ResourceTypeMarker for LoaderConnectToManifestFsRequest {
1159        type Borrowed<'a> = &'a mut Self;
1160        fn take_or_borrow<'a>(
1161            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1162        ) -> Self::Borrowed<'a> {
1163            value
1164        }
1165    }
1166
1167    unsafe impl fidl::encoding::TypeMarker for LoaderConnectToManifestFsRequest {
1168        type Owned = Self;
1169
1170        #[inline(always)]
1171        fn inline_align(_context: fidl::encoding::Context) -> usize {
1172            4
1173        }
1174
1175        #[inline(always)]
1176        fn inline_size(_context: fidl::encoding::Context) -> usize {
1177            8
1178        }
1179    }
1180
1181    unsafe impl
1182        fidl::encoding::Encode<
1183            LoaderConnectToManifestFsRequest,
1184            fidl::encoding::DefaultFuchsiaResourceDialect,
1185        > for &mut LoaderConnectToManifestFsRequest
1186    {
1187        #[inline]
1188        unsafe fn encode(
1189            self,
1190            encoder: &mut fidl::encoding::Encoder<
1191                '_,
1192                fidl::encoding::DefaultFuchsiaResourceDialect,
1193            >,
1194            offset: usize,
1195            _depth: fidl::encoding::Depth,
1196        ) -> fidl::Result<()> {
1197            encoder.debug_check_bounds::<LoaderConnectToManifestFsRequest>(offset);
1198            // Delegate to tuple encoding.
1199            fidl::encoding::Encode::<
1200                LoaderConnectToManifestFsRequest,
1201                fidl::encoding::DefaultFuchsiaResourceDialect,
1202            >::encode(
1203                (
1204                    <ConnectToManifestOptions as fidl::encoding::ValueTypeMarker>::borrow(
1205                        &self.options,
1206                    ),
1207                    <fidl::encoding::HandleType<
1208                        fidl::Channel,
1209                        { fidl::ObjectType::CHANNEL.into_raw() },
1210                        2147483648,
1211                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1212                        &mut self.channel
1213                    ),
1214                ),
1215                encoder,
1216                offset,
1217                _depth,
1218            )
1219        }
1220    }
1221    unsafe impl<
1222        T0: fidl::encoding::Encode<
1223                ConnectToManifestOptions,
1224                fidl::encoding::DefaultFuchsiaResourceDialect,
1225            >,
1226        T1: fidl::encoding::Encode<
1227                fidl::encoding::HandleType<
1228                    fidl::Channel,
1229                    { fidl::ObjectType::CHANNEL.into_raw() },
1230                    2147483648,
1231                >,
1232                fidl::encoding::DefaultFuchsiaResourceDialect,
1233            >,
1234    >
1235        fidl::encoding::Encode<
1236            LoaderConnectToManifestFsRequest,
1237            fidl::encoding::DefaultFuchsiaResourceDialect,
1238        > for (T0, T1)
1239    {
1240        #[inline]
1241        unsafe fn encode(
1242            self,
1243            encoder: &mut fidl::encoding::Encoder<
1244                '_,
1245                fidl::encoding::DefaultFuchsiaResourceDialect,
1246            >,
1247            offset: usize,
1248            depth: fidl::encoding::Depth,
1249        ) -> fidl::Result<()> {
1250            encoder.debug_check_bounds::<LoaderConnectToManifestFsRequest>(offset);
1251            // Zero out padding regions. There's no need to apply masks
1252            // because the unmasked parts will be overwritten by fields.
1253            // Write the fields.
1254            self.0.encode(encoder, offset + 0, depth)?;
1255            self.1.encode(encoder, offset + 4, depth)?;
1256            Ok(())
1257        }
1258    }
1259
1260    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1261        for LoaderConnectToManifestFsRequest
1262    {
1263        #[inline(always)]
1264        fn new_empty() -> Self {
1265            Self {
1266                options: fidl::new_empty!(
1267                    ConnectToManifestOptions,
1268                    fidl::encoding::DefaultFuchsiaResourceDialect
1269                ),
1270                channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1271            }
1272        }
1273
1274        #[inline]
1275        unsafe fn decode(
1276            &mut self,
1277            decoder: &mut fidl::encoding::Decoder<
1278                '_,
1279                fidl::encoding::DefaultFuchsiaResourceDialect,
1280            >,
1281            offset: usize,
1282            _depth: fidl::encoding::Depth,
1283        ) -> fidl::Result<()> {
1284            decoder.debug_check_bounds::<Self>(offset);
1285            // Verify that padding bytes are zero.
1286            fidl::decode!(
1287                ConnectToManifestOptions,
1288                fidl::encoding::DefaultFuchsiaResourceDialect,
1289                &mut self.options,
1290                decoder,
1291                offset + 0,
1292                _depth
1293            )?;
1294            fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.channel, decoder, offset + 4, _depth)?;
1295            Ok(())
1296        }
1297    }
1298
1299    impl fidl::encoding::ResourceTypeMarker for LoaderGetResponse {
1300        type Borrowed<'a> = &'a mut Self;
1301        fn take_or_borrow<'a>(
1302            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1303        ) -> Self::Borrowed<'a> {
1304            value
1305        }
1306    }
1307
1308    unsafe impl fidl::encoding::TypeMarker for LoaderGetResponse {
1309        type Owned = Self;
1310
1311        #[inline(always)]
1312        fn inline_align(_context: fidl::encoding::Context) -> usize {
1313            4
1314        }
1315
1316        #[inline(always)]
1317        fn inline_size(_context: fidl::encoding::Context) -> usize {
1318            4
1319        }
1320    }
1321
1322    unsafe impl
1323        fidl::encoding::Encode<LoaderGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
1324        for &mut LoaderGetResponse
1325    {
1326        #[inline]
1327        unsafe fn encode(
1328            self,
1329            encoder: &mut fidl::encoding::Encoder<
1330                '_,
1331                fidl::encoding::DefaultFuchsiaResourceDialect,
1332            >,
1333            offset: usize,
1334            _depth: fidl::encoding::Depth,
1335        ) -> fidl::Result<()> {
1336            encoder.debug_check_bounds::<LoaderGetResponse>(offset);
1337            // Delegate to tuple encoding.
1338            fidl::encoding::Encode::<LoaderGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1339                (
1340                    <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.lib),
1341                ),
1342                encoder, offset, _depth
1343            )
1344        }
1345    }
1346    unsafe impl<
1347        T0: fidl::encoding::Encode<
1348                fidl::encoding::Optional<
1349                    fidl::encoding::HandleType<
1350                        fidl::Vmo,
1351                        { fidl::ObjectType::VMO.into_raw() },
1352                        2147483648,
1353                    >,
1354                >,
1355                fidl::encoding::DefaultFuchsiaResourceDialect,
1356            >,
1357    > fidl::encoding::Encode<LoaderGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
1358        for (T0,)
1359    {
1360        #[inline]
1361        unsafe fn encode(
1362            self,
1363            encoder: &mut fidl::encoding::Encoder<
1364                '_,
1365                fidl::encoding::DefaultFuchsiaResourceDialect,
1366            >,
1367            offset: usize,
1368            depth: fidl::encoding::Depth,
1369        ) -> fidl::Result<()> {
1370            encoder.debug_check_bounds::<LoaderGetResponse>(offset);
1371            // Zero out padding regions. There's no need to apply masks
1372            // because the unmasked parts will be overwritten by fields.
1373            // Write the fields.
1374            self.0.encode(encoder, offset + 0, depth)?;
1375            Ok(())
1376        }
1377    }
1378
1379    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1380        for LoaderGetResponse
1381    {
1382        #[inline(always)]
1383        fn new_empty() -> Self {
1384            Self {
1385                lib: fidl::new_empty!(
1386                    fidl::encoding::Optional<
1387                        fidl::encoding::HandleType<
1388                            fidl::Vmo,
1389                            { fidl::ObjectType::VMO.into_raw() },
1390                            2147483648,
1391                        >,
1392                    >,
1393                    fidl::encoding::DefaultFuchsiaResourceDialect
1394                ),
1395            }
1396        }
1397
1398        #[inline]
1399        unsafe fn decode(
1400            &mut self,
1401            decoder: &mut fidl::encoding::Decoder<
1402                '_,
1403                fidl::encoding::DefaultFuchsiaResourceDialect,
1404            >,
1405            offset: usize,
1406            _depth: fidl::encoding::Depth,
1407        ) -> fidl::Result<()> {
1408            decoder.debug_check_bounds::<Self>(offset);
1409            // Verify that padding bytes are zero.
1410            fidl::decode!(
1411                fidl::encoding::Optional<
1412                    fidl::encoding::HandleType<
1413                        fidl::Vmo,
1414                        { fidl::ObjectType::VMO.into_raw() },
1415                        2147483648,
1416                    >,
1417                >,
1418                fidl::encoding::DefaultFuchsiaResourceDialect,
1419                &mut self.lib,
1420                decoder,
1421                offset + 0,
1422                _depth
1423            )?;
1424            Ok(())
1425        }
1426    }
1427
1428    impl fidl::encoding::ResourceTypeMarker for LoaderGetVmexResourceResponse {
1429        type Borrowed<'a> = &'a mut Self;
1430        fn take_or_borrow<'a>(
1431            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1432        ) -> Self::Borrowed<'a> {
1433            value
1434        }
1435    }
1436
1437    unsafe impl fidl::encoding::TypeMarker for LoaderGetVmexResourceResponse {
1438        type Owned = Self;
1439
1440        #[inline(always)]
1441        fn inline_align(_context: fidl::encoding::Context) -> usize {
1442            4
1443        }
1444
1445        #[inline(always)]
1446        fn inline_size(_context: fidl::encoding::Context) -> usize {
1447            4
1448        }
1449    }
1450
1451    unsafe impl
1452        fidl::encoding::Encode<
1453            LoaderGetVmexResourceResponse,
1454            fidl::encoding::DefaultFuchsiaResourceDialect,
1455        > for &mut LoaderGetVmexResourceResponse
1456    {
1457        #[inline]
1458        unsafe fn encode(
1459            self,
1460            encoder: &mut fidl::encoding::Encoder<
1461                '_,
1462                fidl::encoding::DefaultFuchsiaResourceDialect,
1463            >,
1464            offset: usize,
1465            _depth: fidl::encoding::Depth,
1466        ) -> fidl::Result<()> {
1467            encoder.debug_check_bounds::<LoaderGetVmexResourceResponse>(offset);
1468            // Delegate to tuple encoding.
1469            fidl::encoding::Encode::<
1470                LoaderGetVmexResourceResponse,
1471                fidl::encoding::DefaultFuchsiaResourceDialect,
1472            >::encode(
1473                (<fidl::encoding::HandleType<
1474                    fidl::Resource,
1475                    { fidl::ObjectType::RESOURCE.into_raw() },
1476                    2147483648,
1477                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1478                    &mut self.resource
1479                ),),
1480                encoder,
1481                offset,
1482                _depth,
1483            )
1484        }
1485    }
1486    unsafe impl<
1487        T0: fidl::encoding::Encode<
1488                fidl::encoding::HandleType<
1489                    fidl::Resource,
1490                    { fidl::ObjectType::RESOURCE.into_raw() },
1491                    2147483648,
1492                >,
1493                fidl::encoding::DefaultFuchsiaResourceDialect,
1494            >,
1495    >
1496        fidl::encoding::Encode<
1497            LoaderGetVmexResourceResponse,
1498            fidl::encoding::DefaultFuchsiaResourceDialect,
1499        > for (T0,)
1500    {
1501        #[inline]
1502        unsafe fn encode(
1503            self,
1504            encoder: &mut fidl::encoding::Encoder<
1505                '_,
1506                fidl::encoding::DefaultFuchsiaResourceDialect,
1507            >,
1508            offset: usize,
1509            depth: fidl::encoding::Depth,
1510        ) -> fidl::Result<()> {
1511            encoder.debug_check_bounds::<LoaderGetVmexResourceResponse>(offset);
1512            // Zero out padding regions. There's no need to apply masks
1513            // because the unmasked parts will be overwritten by fields.
1514            // Write the fields.
1515            self.0.encode(encoder, offset + 0, depth)?;
1516            Ok(())
1517        }
1518    }
1519
1520    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1521        for LoaderGetVmexResourceResponse
1522    {
1523        #[inline(always)]
1524        fn new_empty() -> Self {
1525            Self {
1526                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1527            }
1528        }
1529
1530        #[inline]
1531        unsafe fn decode(
1532            &mut self,
1533            decoder: &mut fidl::encoding::Decoder<
1534                '_,
1535                fidl::encoding::DefaultFuchsiaResourceDialect,
1536            >,
1537            offset: usize,
1538            _depth: fidl::encoding::Depth,
1539        ) -> fidl::Result<()> {
1540            decoder.debug_check_bounds::<Self>(offset);
1541            // Verify that padding bytes are zero.
1542            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
1543            Ok(())
1544        }
1545    }
1546}