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