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