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