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 fidl::endpoints::ControlHandle for LoaderControlHandle {
723    fn shutdown(&self) {
724        self.inner.shutdown()
725    }
726
727    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
728        self.inner.shutdown_with_epitaph(status)
729    }
730
731    fn is_closed(&self) -> bool {
732        self.inner.channel().is_closed()
733    }
734    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
735        self.inner.channel().on_closed()
736    }
737
738    #[cfg(target_os = "fuchsia")]
739    fn signal_peer(
740        &self,
741        clear_mask: zx::Signals,
742        set_mask: zx::Signals,
743    ) -> Result<(), zx_status::Status> {
744        use fidl::Peered;
745        self.inner.channel().signal_peer(clear_mask, set_mask)
746    }
747}
748
749impl LoaderControlHandle {}
750
751#[must_use = "FIDL methods require a response to be sent"]
752#[derive(Debug)]
753pub struct LoaderGetResponder {
754    control_handle: std::mem::ManuallyDrop<LoaderControlHandle>,
755    tx_id: u32,
756}
757
758/// Set the the channel to be shutdown (see [`LoaderControlHandle::shutdown`])
759/// if the responder is dropped without sending a response, so that the client
760/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
761impl std::ops::Drop for LoaderGetResponder {
762    fn drop(&mut self) {
763        self.control_handle.shutdown();
764        // Safety: drops once, never accessed again
765        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
766    }
767}
768
769impl fidl::endpoints::Responder for LoaderGetResponder {
770    type ControlHandle = LoaderControlHandle;
771
772    fn control_handle(&self) -> &LoaderControlHandle {
773        &self.control_handle
774    }
775
776    fn drop_without_shutdown(mut self) {
777        // Safety: drops once, never accessed again due to mem::forget
778        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
779        // Prevent Drop from running (which would shut down the channel)
780        std::mem::forget(self);
781    }
782}
783
784impl LoaderGetResponder {
785    /// Sends a response to the FIDL transaction.
786    ///
787    /// Sets the channel to shutdown if an error occurs.
788    pub fn send(self, mut lib: Option<fidl::Vmo>) -> Result<(), fidl::Error> {
789        let _result = self.send_raw(lib);
790        if _result.is_err() {
791            self.control_handle.shutdown();
792        }
793        self.drop_without_shutdown();
794        _result
795    }
796
797    /// Similar to "send" but does not shutdown the channel if an error occurs.
798    pub fn send_no_shutdown_on_err(self, mut lib: Option<fidl::Vmo>) -> Result<(), fidl::Error> {
799        let _result = self.send_raw(lib);
800        self.drop_without_shutdown();
801        _result
802    }
803
804    fn send_raw(&self, mut lib: Option<fidl::Vmo>) -> Result<(), fidl::Error> {
805        self.control_handle.inner.send::<LoaderGetResponse>(
806            (lib,),
807            self.tx_id,
808            0x73dbbfb62e99320a,
809            fidl::encoding::DynamicFlags::empty(),
810        )
811    }
812}
813
814#[must_use = "FIDL methods require a response to be sent"]
815#[derive(Debug)]
816pub struct LoaderGetSupportedFeaturesResponder {
817    control_handle: std::mem::ManuallyDrop<LoaderControlHandle>,
818    tx_id: u32,
819}
820
821/// Set the the channel to be shutdown (see [`LoaderControlHandle::shutdown`])
822/// if the responder is dropped without sending a response, so that the client
823/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
824impl std::ops::Drop for LoaderGetSupportedFeaturesResponder {
825    fn drop(&mut self) {
826        self.control_handle.shutdown();
827        // Safety: drops once, never accessed again
828        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
829    }
830}
831
832impl fidl::endpoints::Responder for LoaderGetSupportedFeaturesResponder {
833    type ControlHandle = LoaderControlHandle;
834
835    fn control_handle(&self) -> &LoaderControlHandle {
836        &self.control_handle
837    }
838
839    fn drop_without_shutdown(mut self) {
840        // Safety: drops once, never accessed again due to mem::forget
841        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
842        // Prevent Drop from running (which would shut down the channel)
843        std::mem::forget(self);
844    }
845}
846
847impl LoaderGetSupportedFeaturesResponder {
848    /// Sends a response to the FIDL transaction.
849    ///
850    /// Sets the channel to shutdown if an error occurs.
851    pub fn send(self, mut features: Features) -> Result<(), fidl::Error> {
852        let _result = self.send_raw(features);
853        if _result.is_err() {
854            self.control_handle.shutdown();
855        }
856        self.drop_without_shutdown();
857        _result
858    }
859
860    /// Similar to "send" but does not shutdown the channel if an error occurs.
861    pub fn send_no_shutdown_on_err(self, mut features: Features) -> Result<(), fidl::Error> {
862        let _result = self.send_raw(features);
863        self.drop_without_shutdown();
864        _result
865    }
866
867    fn send_raw(&self, mut features: Features) -> Result<(), fidl::Error> {
868        self.control_handle.inner.send::<LoaderGetSupportedFeaturesResponse>(
869            (features,),
870            self.tx_id,
871            0x381abfce172892bd,
872            fidl::encoding::DynamicFlags::empty(),
873        )
874    }
875}
876
877#[must_use = "FIDL methods require a response to be sent"]
878#[derive(Debug)]
879pub struct LoaderGetVmexResourceResponder {
880    control_handle: std::mem::ManuallyDrop<LoaderControlHandle>,
881    tx_id: u32,
882}
883
884/// Set the the channel to be shutdown (see [`LoaderControlHandle::shutdown`])
885/// if the responder is dropped without sending a response, so that the client
886/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
887impl std::ops::Drop for LoaderGetVmexResourceResponder {
888    fn drop(&mut self) {
889        self.control_handle.shutdown();
890        // Safety: drops once, never accessed again
891        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
892    }
893}
894
895impl fidl::endpoints::Responder for LoaderGetVmexResourceResponder {
896    type ControlHandle = LoaderControlHandle;
897
898    fn control_handle(&self) -> &LoaderControlHandle {
899        &self.control_handle
900    }
901
902    fn drop_without_shutdown(mut self) {
903        // Safety: drops once, never accessed again due to mem::forget
904        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
905        // Prevent Drop from running (which would shut down the channel)
906        std::mem::forget(self);
907    }
908}
909
910impl LoaderGetVmexResourceResponder {
911    /// Sends a response to the FIDL transaction.
912    ///
913    /// Sets the channel to shutdown if an error occurs.
914    pub fn send(
915        self,
916        mut result: Result<fidl::Resource, GetVmexResourceError>,
917    ) -> Result<(), fidl::Error> {
918        let _result = self.send_raw(result);
919        if _result.is_err() {
920            self.control_handle.shutdown();
921        }
922        self.drop_without_shutdown();
923        _result
924    }
925
926    /// Similar to "send" but does not shutdown the channel if an error occurs.
927    pub fn send_no_shutdown_on_err(
928        self,
929        mut result: Result<fidl::Resource, GetVmexResourceError>,
930    ) -> Result<(), fidl::Error> {
931        let _result = self.send_raw(result);
932        self.drop_without_shutdown();
933        _result
934    }
935
936    fn send_raw(
937        &self,
938        mut result: Result<fidl::Resource, GetVmexResourceError>,
939    ) -> Result<(), fidl::Error> {
940        self.control_handle.inner.send::<fidl::encoding::ResultType<
941            LoaderGetVmexResourceResponse,
942            GetVmexResourceError,
943        >>(
944            result.map(|resource| (resource,)),
945            self.tx_id,
946            0x71aea090ffef259b,
947            fidl::encoding::DynamicFlags::empty(),
948        )
949    }
950}
951
952#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
953pub struct TrustedServiceMarker;
954
955#[cfg(target_os = "fuchsia")]
956impl fidl::endpoints::ServiceMarker for TrustedServiceMarker {
957    type Proxy = TrustedServiceProxy;
958    type Request = TrustedServiceRequest;
959    const SERVICE_NAME: &'static str = "fuchsia.vulkan.loader.TrustedService";
960}
961
962/// A request for one of the member protocols of TrustedService.
963///
964/// Provides expanded device node access to trusted clients.
965#[cfg(target_os = "fuchsia")]
966pub enum TrustedServiceRequest {
967    Loader(LoaderRequestStream),
968}
969
970#[cfg(target_os = "fuchsia")]
971impl fidl::endpoints::ServiceRequest for TrustedServiceRequest {
972    type Service = TrustedServiceMarker;
973
974    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
975        match name {
976            "loader" => Self::Loader(
977                <LoaderRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
978            ),
979            _ => panic!("no such member protocol name for service TrustedService"),
980        }
981    }
982
983    fn member_names() -> &'static [&'static str] {
984        &["loader"]
985    }
986}
987/// Provides expanded device node access to trusted clients.
988#[cfg(target_os = "fuchsia")]
989pub struct TrustedServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
990
991#[cfg(target_os = "fuchsia")]
992impl fidl::endpoints::ServiceProxy for TrustedServiceProxy {
993    type Service = TrustedServiceMarker;
994
995    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
996        Self(opener)
997    }
998}
999
1000#[cfg(target_os = "fuchsia")]
1001impl TrustedServiceProxy {
1002    pub fn connect_to_loader(&self) -> Result<LoaderProxy, fidl::Error> {
1003        let (proxy, server_end) = fidl::endpoints::create_proxy::<LoaderMarker>();
1004        self.connect_channel_to_loader(server_end)?;
1005        Ok(proxy)
1006    }
1007
1008    /// Like `connect_to_loader`, but returns a sync proxy.
1009    /// See [`Self::connect_to_loader`] for more details.
1010    pub fn connect_to_loader_sync(&self) -> Result<LoaderSynchronousProxy, fidl::Error> {
1011        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<LoaderMarker>();
1012        self.connect_channel_to_loader(server_end)?;
1013        Ok(proxy)
1014    }
1015
1016    /// Like `connect_to_loader`, but accepts a server end.
1017    /// See [`Self::connect_to_loader`] for more details.
1018    pub fn connect_channel_to_loader(
1019        &self,
1020        server_end: fidl::endpoints::ServerEnd<LoaderMarker>,
1021    ) -> Result<(), fidl::Error> {
1022        self.0.open_member("loader", server_end.into_channel())
1023    }
1024
1025    pub fn instance_name(&self) -> &str {
1026        self.0.instance_name()
1027    }
1028}
1029
1030mod internal {
1031    use super::*;
1032
1033    impl fidl::encoding::ResourceTypeMarker for LoaderConnectToDeviceFsRequest {
1034        type Borrowed<'a> = &'a mut Self;
1035        fn take_or_borrow<'a>(
1036            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1037        ) -> Self::Borrowed<'a> {
1038            value
1039        }
1040    }
1041
1042    unsafe impl fidl::encoding::TypeMarker for LoaderConnectToDeviceFsRequest {
1043        type Owned = Self;
1044
1045        #[inline(always)]
1046        fn inline_align(_context: fidl::encoding::Context) -> usize {
1047            4
1048        }
1049
1050        #[inline(always)]
1051        fn inline_size(_context: fidl::encoding::Context) -> usize {
1052            4
1053        }
1054    }
1055
1056    unsafe impl
1057        fidl::encoding::Encode<
1058            LoaderConnectToDeviceFsRequest,
1059            fidl::encoding::DefaultFuchsiaResourceDialect,
1060        > for &mut LoaderConnectToDeviceFsRequest
1061    {
1062        #[inline]
1063        unsafe fn encode(
1064            self,
1065            encoder: &mut fidl::encoding::Encoder<
1066                '_,
1067                fidl::encoding::DefaultFuchsiaResourceDialect,
1068            >,
1069            offset: usize,
1070            _depth: fidl::encoding::Depth,
1071        ) -> fidl::Result<()> {
1072            encoder.debug_check_bounds::<LoaderConnectToDeviceFsRequest>(offset);
1073            // Delegate to tuple encoding.
1074            fidl::encoding::Encode::<
1075                LoaderConnectToDeviceFsRequest,
1076                fidl::encoding::DefaultFuchsiaResourceDialect,
1077            >::encode(
1078                (<fidl::encoding::HandleType<
1079                    fidl::Channel,
1080                    { fidl::ObjectType::CHANNEL.into_raw() },
1081                    2147483648,
1082                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1083                    &mut self.channel
1084                ),),
1085                encoder,
1086                offset,
1087                _depth,
1088            )
1089        }
1090    }
1091    unsafe impl<
1092        T0: fidl::encoding::Encode<
1093                fidl::encoding::HandleType<
1094                    fidl::Channel,
1095                    { fidl::ObjectType::CHANNEL.into_raw() },
1096                    2147483648,
1097                >,
1098                fidl::encoding::DefaultFuchsiaResourceDialect,
1099            >,
1100    >
1101        fidl::encoding::Encode<
1102            LoaderConnectToDeviceFsRequest,
1103            fidl::encoding::DefaultFuchsiaResourceDialect,
1104        > for (T0,)
1105    {
1106        #[inline]
1107        unsafe fn encode(
1108            self,
1109            encoder: &mut fidl::encoding::Encoder<
1110                '_,
1111                fidl::encoding::DefaultFuchsiaResourceDialect,
1112            >,
1113            offset: usize,
1114            depth: fidl::encoding::Depth,
1115        ) -> fidl::Result<()> {
1116            encoder.debug_check_bounds::<LoaderConnectToDeviceFsRequest>(offset);
1117            // Zero out padding regions. There's no need to apply masks
1118            // because the unmasked parts will be overwritten by fields.
1119            // Write the fields.
1120            self.0.encode(encoder, offset + 0, depth)?;
1121            Ok(())
1122        }
1123    }
1124
1125    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1126        for LoaderConnectToDeviceFsRequest
1127    {
1128        #[inline(always)]
1129        fn new_empty() -> Self {
1130            Self {
1131                channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1132            }
1133        }
1134
1135        #[inline]
1136        unsafe fn decode(
1137            &mut self,
1138            decoder: &mut fidl::encoding::Decoder<
1139                '_,
1140                fidl::encoding::DefaultFuchsiaResourceDialect,
1141            >,
1142            offset: usize,
1143            _depth: fidl::encoding::Depth,
1144        ) -> fidl::Result<()> {
1145            decoder.debug_check_bounds::<Self>(offset);
1146            // Verify that padding bytes are zero.
1147            fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.channel, decoder, offset + 0, _depth)?;
1148            Ok(())
1149        }
1150    }
1151
1152    impl fidl::encoding::ResourceTypeMarker for LoaderConnectToManifestFsRequest {
1153        type Borrowed<'a> = &'a mut Self;
1154        fn take_or_borrow<'a>(
1155            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1156        ) -> Self::Borrowed<'a> {
1157            value
1158        }
1159    }
1160
1161    unsafe impl fidl::encoding::TypeMarker for LoaderConnectToManifestFsRequest {
1162        type Owned = Self;
1163
1164        #[inline(always)]
1165        fn inline_align(_context: fidl::encoding::Context) -> usize {
1166            4
1167        }
1168
1169        #[inline(always)]
1170        fn inline_size(_context: fidl::encoding::Context) -> usize {
1171            8
1172        }
1173    }
1174
1175    unsafe impl
1176        fidl::encoding::Encode<
1177            LoaderConnectToManifestFsRequest,
1178            fidl::encoding::DefaultFuchsiaResourceDialect,
1179        > for &mut LoaderConnectToManifestFsRequest
1180    {
1181        #[inline]
1182        unsafe fn encode(
1183            self,
1184            encoder: &mut fidl::encoding::Encoder<
1185                '_,
1186                fidl::encoding::DefaultFuchsiaResourceDialect,
1187            >,
1188            offset: usize,
1189            _depth: fidl::encoding::Depth,
1190        ) -> fidl::Result<()> {
1191            encoder.debug_check_bounds::<LoaderConnectToManifestFsRequest>(offset);
1192            // Delegate to tuple encoding.
1193            fidl::encoding::Encode::<
1194                LoaderConnectToManifestFsRequest,
1195                fidl::encoding::DefaultFuchsiaResourceDialect,
1196            >::encode(
1197                (
1198                    <ConnectToManifestOptions as fidl::encoding::ValueTypeMarker>::borrow(
1199                        &self.options,
1200                    ),
1201                    <fidl::encoding::HandleType<
1202                        fidl::Channel,
1203                        { fidl::ObjectType::CHANNEL.into_raw() },
1204                        2147483648,
1205                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1206                        &mut self.channel
1207                    ),
1208                ),
1209                encoder,
1210                offset,
1211                _depth,
1212            )
1213        }
1214    }
1215    unsafe impl<
1216        T0: fidl::encoding::Encode<
1217                ConnectToManifestOptions,
1218                fidl::encoding::DefaultFuchsiaResourceDialect,
1219            >,
1220        T1: fidl::encoding::Encode<
1221                fidl::encoding::HandleType<
1222                    fidl::Channel,
1223                    { fidl::ObjectType::CHANNEL.into_raw() },
1224                    2147483648,
1225                >,
1226                fidl::encoding::DefaultFuchsiaResourceDialect,
1227            >,
1228    >
1229        fidl::encoding::Encode<
1230            LoaderConnectToManifestFsRequest,
1231            fidl::encoding::DefaultFuchsiaResourceDialect,
1232        > for (T0, T1)
1233    {
1234        #[inline]
1235        unsafe fn encode(
1236            self,
1237            encoder: &mut fidl::encoding::Encoder<
1238                '_,
1239                fidl::encoding::DefaultFuchsiaResourceDialect,
1240            >,
1241            offset: usize,
1242            depth: fidl::encoding::Depth,
1243        ) -> fidl::Result<()> {
1244            encoder.debug_check_bounds::<LoaderConnectToManifestFsRequest>(offset);
1245            // Zero out padding regions. There's no need to apply masks
1246            // because the unmasked parts will be overwritten by fields.
1247            // Write the fields.
1248            self.0.encode(encoder, offset + 0, depth)?;
1249            self.1.encode(encoder, offset + 4, depth)?;
1250            Ok(())
1251        }
1252    }
1253
1254    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1255        for LoaderConnectToManifestFsRequest
1256    {
1257        #[inline(always)]
1258        fn new_empty() -> Self {
1259            Self {
1260                options: fidl::new_empty!(
1261                    ConnectToManifestOptions,
1262                    fidl::encoding::DefaultFuchsiaResourceDialect
1263                ),
1264                channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1265            }
1266        }
1267
1268        #[inline]
1269        unsafe fn decode(
1270            &mut self,
1271            decoder: &mut fidl::encoding::Decoder<
1272                '_,
1273                fidl::encoding::DefaultFuchsiaResourceDialect,
1274            >,
1275            offset: usize,
1276            _depth: fidl::encoding::Depth,
1277        ) -> fidl::Result<()> {
1278            decoder.debug_check_bounds::<Self>(offset);
1279            // Verify that padding bytes are zero.
1280            fidl::decode!(
1281                ConnectToManifestOptions,
1282                fidl::encoding::DefaultFuchsiaResourceDialect,
1283                &mut self.options,
1284                decoder,
1285                offset + 0,
1286                _depth
1287            )?;
1288            fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.channel, decoder, offset + 4, _depth)?;
1289            Ok(())
1290        }
1291    }
1292
1293    impl fidl::encoding::ResourceTypeMarker for LoaderGetResponse {
1294        type Borrowed<'a> = &'a mut Self;
1295        fn take_or_borrow<'a>(
1296            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1297        ) -> Self::Borrowed<'a> {
1298            value
1299        }
1300    }
1301
1302    unsafe impl fidl::encoding::TypeMarker for LoaderGetResponse {
1303        type Owned = Self;
1304
1305        #[inline(always)]
1306        fn inline_align(_context: fidl::encoding::Context) -> usize {
1307            4
1308        }
1309
1310        #[inline(always)]
1311        fn inline_size(_context: fidl::encoding::Context) -> usize {
1312            4
1313        }
1314    }
1315
1316    unsafe impl
1317        fidl::encoding::Encode<LoaderGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
1318        for &mut LoaderGetResponse
1319    {
1320        #[inline]
1321        unsafe fn encode(
1322            self,
1323            encoder: &mut fidl::encoding::Encoder<
1324                '_,
1325                fidl::encoding::DefaultFuchsiaResourceDialect,
1326            >,
1327            offset: usize,
1328            _depth: fidl::encoding::Depth,
1329        ) -> fidl::Result<()> {
1330            encoder.debug_check_bounds::<LoaderGetResponse>(offset);
1331            // Delegate to tuple encoding.
1332            fidl::encoding::Encode::<LoaderGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1333                (
1334                    <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.lib),
1335                ),
1336                encoder, offset, _depth
1337            )
1338        }
1339    }
1340    unsafe impl<
1341        T0: fidl::encoding::Encode<
1342                fidl::encoding::Optional<
1343                    fidl::encoding::HandleType<
1344                        fidl::Vmo,
1345                        { fidl::ObjectType::VMO.into_raw() },
1346                        2147483648,
1347                    >,
1348                >,
1349                fidl::encoding::DefaultFuchsiaResourceDialect,
1350            >,
1351    > fidl::encoding::Encode<LoaderGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
1352        for (T0,)
1353    {
1354        #[inline]
1355        unsafe fn encode(
1356            self,
1357            encoder: &mut fidl::encoding::Encoder<
1358                '_,
1359                fidl::encoding::DefaultFuchsiaResourceDialect,
1360            >,
1361            offset: usize,
1362            depth: fidl::encoding::Depth,
1363        ) -> fidl::Result<()> {
1364            encoder.debug_check_bounds::<LoaderGetResponse>(offset);
1365            // Zero out padding regions. There's no need to apply masks
1366            // because the unmasked parts will be overwritten by fields.
1367            // Write the fields.
1368            self.0.encode(encoder, offset + 0, depth)?;
1369            Ok(())
1370        }
1371    }
1372
1373    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1374        for LoaderGetResponse
1375    {
1376        #[inline(always)]
1377        fn new_empty() -> Self {
1378            Self {
1379                lib: fidl::new_empty!(
1380                    fidl::encoding::Optional<
1381                        fidl::encoding::HandleType<
1382                            fidl::Vmo,
1383                            { fidl::ObjectType::VMO.into_raw() },
1384                            2147483648,
1385                        >,
1386                    >,
1387                    fidl::encoding::DefaultFuchsiaResourceDialect
1388                ),
1389            }
1390        }
1391
1392        #[inline]
1393        unsafe fn decode(
1394            &mut self,
1395            decoder: &mut fidl::encoding::Decoder<
1396                '_,
1397                fidl::encoding::DefaultFuchsiaResourceDialect,
1398            >,
1399            offset: usize,
1400            _depth: fidl::encoding::Depth,
1401        ) -> fidl::Result<()> {
1402            decoder.debug_check_bounds::<Self>(offset);
1403            // Verify that padding bytes are zero.
1404            fidl::decode!(
1405                fidl::encoding::Optional<
1406                    fidl::encoding::HandleType<
1407                        fidl::Vmo,
1408                        { fidl::ObjectType::VMO.into_raw() },
1409                        2147483648,
1410                    >,
1411                >,
1412                fidl::encoding::DefaultFuchsiaResourceDialect,
1413                &mut self.lib,
1414                decoder,
1415                offset + 0,
1416                _depth
1417            )?;
1418            Ok(())
1419        }
1420    }
1421
1422    impl fidl::encoding::ResourceTypeMarker for LoaderGetVmexResourceResponse {
1423        type Borrowed<'a> = &'a mut Self;
1424        fn take_or_borrow<'a>(
1425            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1426        ) -> Self::Borrowed<'a> {
1427            value
1428        }
1429    }
1430
1431    unsafe impl fidl::encoding::TypeMarker for LoaderGetVmexResourceResponse {
1432        type Owned = Self;
1433
1434        #[inline(always)]
1435        fn inline_align(_context: fidl::encoding::Context) -> usize {
1436            4
1437        }
1438
1439        #[inline(always)]
1440        fn inline_size(_context: fidl::encoding::Context) -> usize {
1441            4
1442        }
1443    }
1444
1445    unsafe impl
1446        fidl::encoding::Encode<
1447            LoaderGetVmexResourceResponse,
1448            fidl::encoding::DefaultFuchsiaResourceDialect,
1449        > for &mut LoaderGetVmexResourceResponse
1450    {
1451        #[inline]
1452        unsafe fn encode(
1453            self,
1454            encoder: &mut fidl::encoding::Encoder<
1455                '_,
1456                fidl::encoding::DefaultFuchsiaResourceDialect,
1457            >,
1458            offset: usize,
1459            _depth: fidl::encoding::Depth,
1460        ) -> fidl::Result<()> {
1461            encoder.debug_check_bounds::<LoaderGetVmexResourceResponse>(offset);
1462            // Delegate to tuple encoding.
1463            fidl::encoding::Encode::<
1464                LoaderGetVmexResourceResponse,
1465                fidl::encoding::DefaultFuchsiaResourceDialect,
1466            >::encode(
1467                (<fidl::encoding::HandleType<
1468                    fidl::Resource,
1469                    { fidl::ObjectType::RESOURCE.into_raw() },
1470                    2147483648,
1471                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1472                    &mut self.resource
1473                ),),
1474                encoder,
1475                offset,
1476                _depth,
1477            )
1478        }
1479    }
1480    unsafe impl<
1481        T0: fidl::encoding::Encode<
1482                fidl::encoding::HandleType<
1483                    fidl::Resource,
1484                    { fidl::ObjectType::RESOURCE.into_raw() },
1485                    2147483648,
1486                >,
1487                fidl::encoding::DefaultFuchsiaResourceDialect,
1488            >,
1489    >
1490        fidl::encoding::Encode<
1491            LoaderGetVmexResourceResponse,
1492            fidl::encoding::DefaultFuchsiaResourceDialect,
1493        > for (T0,)
1494    {
1495        #[inline]
1496        unsafe fn encode(
1497            self,
1498            encoder: &mut fidl::encoding::Encoder<
1499                '_,
1500                fidl::encoding::DefaultFuchsiaResourceDialect,
1501            >,
1502            offset: usize,
1503            depth: fidl::encoding::Depth,
1504        ) -> fidl::Result<()> {
1505            encoder.debug_check_bounds::<LoaderGetVmexResourceResponse>(offset);
1506            // Zero out padding regions. There's no need to apply masks
1507            // because the unmasked parts will be overwritten by fields.
1508            // Write the fields.
1509            self.0.encode(encoder, offset + 0, depth)?;
1510            Ok(())
1511        }
1512    }
1513
1514    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1515        for LoaderGetVmexResourceResponse
1516    {
1517        #[inline(always)]
1518        fn new_empty() -> Self {
1519            Self {
1520                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1521            }
1522        }
1523
1524        #[inline]
1525        unsafe fn decode(
1526            &mut self,
1527            decoder: &mut fidl::encoding::Decoder<
1528                '_,
1529                fidl::encoding::DefaultFuchsiaResourceDialect,
1530            >,
1531            offset: usize,
1532            _depth: fidl::encoding::Depth,
1533        ) -> fidl::Result<()> {
1534            decoder.debug_check_bounds::<Self>(offset);
1535            // Verify that padding bytes are zero.
1536            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
1537            Ok(())
1538        }
1539    }
1540}