fidl_next_fuchsia_ldsvc/
fidl_next_fuchsia_ldsvc.rs

1// DO NOT EDIT: This file is machine-generated by fidlgen
2#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7    pub use fidl_next_common_fuchsia_ldsvc::natural::*;
8
9    #[derive(PartialEq, Debug)]
10    #[repr(C)]
11    pub struct LoaderLoadObjectResponse {
12        pub rv: i32,
13
14        pub object: ::core::option::Option<::fidl_next::fuchsia::zx::Vmo>,
15    }
16
17    unsafe impl<___E> ::fidl_next::Encode<crate::wire::LoaderLoadObjectResponse, ___E>
18        for LoaderLoadObjectResponse
19    where
20        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
21        ___E: ::fidl_next::fuchsia::HandleEncoder,
22    {
23        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
24            Self,
25            crate::wire::LoaderLoadObjectResponse,
26        > = unsafe {
27            ::fidl_next::CopyOptimization::enable_if(
28            true
29
30                && <
31                    i32 as ::fidl_next::Encode<::fidl_next::WireI32, ___E>
32                >::COPY_OPTIMIZATION.is_enabled()
33
34                && <
35                    ::core::option::Option<::fidl_next::fuchsia::zx::Vmo> as ::fidl_next::Encode<::fidl_next::fuchsia::WireOptionalVmo, ___E>
36                >::COPY_OPTIMIZATION.is_enabled()
37
38        )
39        };
40
41        #[inline]
42        fn encode(
43            self,
44            encoder_: &mut ___E,
45            out_: &mut ::core::mem::MaybeUninit<crate::wire::LoaderLoadObjectResponse>,
46            _: (),
47        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
48            ::fidl_next::munge! {
49                let crate::wire::LoaderLoadObjectResponse {
50                    rv,
51                    object,
52
53                } = out_;
54            }
55
56            ::fidl_next::Encode::encode(self.rv, encoder_, rv, ())?;
57
58            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(rv.as_mut_ptr()) };
59
60            ::fidl_next::Encode::encode(self.object, encoder_, object, ())?;
61
62            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(object.as_mut_ptr()) };
63
64            Ok(())
65        }
66    }
67
68    unsafe impl<___E>
69        ::fidl_next::EncodeOption<
70            ::fidl_next::WireBox<'static, crate::wire::LoaderLoadObjectResponse>,
71            ___E,
72        > for LoaderLoadObjectResponse
73    where
74        ___E: ::fidl_next::Encoder + ?Sized,
75        LoaderLoadObjectResponse: ::fidl_next::Encode<crate::wire::LoaderLoadObjectResponse, ___E>,
76    {
77        #[inline]
78        fn encode_option(
79            this: ::core::option::Option<Self>,
80            encoder: &mut ___E,
81            out: &mut ::core::mem::MaybeUninit<
82                ::fidl_next::WireBox<'static, crate::wire::LoaderLoadObjectResponse>,
83            >,
84            _: (),
85        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
86            if let Some(inner) = this {
87                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
88                ::fidl_next::WireBox::encode_present(out);
89            } else {
90                ::fidl_next::WireBox::encode_absent(out);
91            }
92
93            Ok(())
94        }
95    }
96
97    impl ::fidl_next::FromWire<crate::wire::LoaderLoadObjectResponse> for LoaderLoadObjectResponse {
98        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
99            crate::wire::LoaderLoadObjectResponse,
100            Self,
101        > = unsafe {
102            ::fidl_next::CopyOptimization::enable_if(
103            true
104
105                && <
106                    i32 as ::fidl_next::FromWire<::fidl_next::WireI32>
107                >::COPY_OPTIMIZATION.is_enabled()
108
109                && <
110                    ::core::option::Option<::fidl_next::fuchsia::zx::Vmo> as ::fidl_next::FromWire<::fidl_next::fuchsia::WireOptionalVmo>
111                >::COPY_OPTIMIZATION.is_enabled()
112
113        )
114        };
115
116        #[inline]
117        fn from_wire(wire: crate::wire::LoaderLoadObjectResponse) -> Self {
118            Self {
119                rv: ::fidl_next::FromWire::from_wire(wire.rv),
120
121                object: ::fidl_next::FromWire::from_wire(wire.object),
122            }
123        }
124    }
125
126    #[derive(PartialEq, Debug)]
127    #[repr(C)]
128    pub struct LoaderCloneRequest {
129        pub loader: ::fidl_next::ServerEnd<crate::Loader, ::fidl_next::fuchsia::zx::Channel>,
130    }
131
132    unsafe impl<___E> ::fidl_next::Encode<crate::wire::LoaderCloneRequest, ___E> for LoaderCloneRequest
133    where
134        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
135        ___E: ::fidl_next::fuchsia::HandleEncoder,
136    {
137        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
138            Self,
139            crate::wire::LoaderCloneRequest,
140        > = unsafe {
141            ::fidl_next::CopyOptimization::enable_if(
142            true
143
144                && <
145                    ::fidl_next::ServerEnd<crate::Loader, ::fidl_next::fuchsia::zx::Channel> as ::fidl_next::Encode<::fidl_next::ServerEnd<crate::Loader, ::fidl_next::fuchsia::WireChannel>, ___E>
146                >::COPY_OPTIMIZATION.is_enabled()
147
148        )
149        };
150
151        #[inline]
152        fn encode(
153            self,
154            encoder_: &mut ___E,
155            out_: &mut ::core::mem::MaybeUninit<crate::wire::LoaderCloneRequest>,
156            _: (),
157        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
158            ::fidl_next::munge! {
159                let crate::wire::LoaderCloneRequest {
160                    loader,
161
162                } = out_;
163            }
164
165            ::fidl_next::Encode::encode(self.loader, encoder_, loader, ())?;
166
167            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(loader.as_mut_ptr()) };
168
169            Ok(())
170        }
171    }
172
173    unsafe impl<___E>
174        ::fidl_next::EncodeOption<
175            ::fidl_next::WireBox<'static, crate::wire::LoaderCloneRequest>,
176            ___E,
177        > for LoaderCloneRequest
178    where
179        ___E: ::fidl_next::Encoder + ?Sized,
180        LoaderCloneRequest: ::fidl_next::Encode<crate::wire::LoaderCloneRequest, ___E>,
181    {
182        #[inline]
183        fn encode_option(
184            this: ::core::option::Option<Self>,
185            encoder: &mut ___E,
186            out: &mut ::core::mem::MaybeUninit<
187                ::fidl_next::WireBox<'static, crate::wire::LoaderCloneRequest>,
188            >,
189            _: (),
190        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
191            if let Some(inner) = this {
192                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
193                ::fidl_next::WireBox::encode_present(out);
194            } else {
195                ::fidl_next::WireBox::encode_absent(out);
196            }
197
198            Ok(())
199        }
200    }
201
202    impl ::fidl_next::FromWire<crate::wire::LoaderCloneRequest> for LoaderCloneRequest {
203        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
204            crate::wire::LoaderCloneRequest,
205            Self,
206        > = unsafe {
207            ::fidl_next::CopyOptimization::enable_if(
208            true
209
210                && <
211                    ::fidl_next::ServerEnd<crate::Loader, ::fidl_next::fuchsia::zx::Channel> as ::fidl_next::FromWire<::fidl_next::ServerEnd<crate::Loader, ::fidl_next::fuchsia::WireChannel>>
212                >::COPY_OPTIMIZATION.is_enabled()
213
214        )
215        };
216
217        #[inline]
218        fn from_wire(wire: crate::wire::LoaderCloneRequest) -> Self {
219            Self { loader: ::fidl_next::FromWire::from_wire(wire.loader) }
220        }
221    }
222}
223
224pub mod wire {
225
226    pub use fidl_next_common_fuchsia_ldsvc::wire::*;
227
228    /// The wire type corresponding to [`LoaderLoadObjectResponse`].
229    #[derive(Debug)]
230    #[repr(C)]
231    pub struct LoaderLoadObjectResponse {
232        pub rv: ::fidl_next::WireI32,
233
234        pub object: ::fidl_next::fuchsia::WireOptionalVmo,
235    }
236
237    static_assertions::const_assert_eq!(std::mem::size_of::<LoaderLoadObjectResponse>(), 8);
238    static_assertions::const_assert_eq!(std::mem::align_of::<LoaderLoadObjectResponse>(), 4);
239
240    static_assertions::const_assert_eq!(std::mem::offset_of!(LoaderLoadObjectResponse, rv), 0);
241
242    static_assertions::const_assert_eq!(std::mem::offset_of!(LoaderLoadObjectResponse, object), 4);
243
244    unsafe impl ::fidl_next::Wire for LoaderLoadObjectResponse {
245        type Owned<'de> = LoaderLoadObjectResponse;
246
247        #[inline]
248        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
249            ::fidl_next::munge! {
250                let Self {
251
252                    rv,
253                    object,
254
255                } = &mut *out_;
256            }
257
258            ::fidl_next::Wire::zero_padding(rv);
259
260            ::fidl_next::Wire::zero_padding(object);
261        }
262    }
263
264    unsafe impl<___D> ::fidl_next::Decode<___D> for LoaderLoadObjectResponse
265    where
266        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
267        ___D: ::fidl_next::fuchsia::HandleDecoder,
268    {
269        fn decode(
270            slot_: ::fidl_next::Slot<'_, Self>,
271            decoder_: &mut ___D,
272            _: (),
273        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
274            ::fidl_next::munge! {
275                let Self {
276
277                    mut rv,
278                    mut object,
279
280                } = slot_;
281            }
282
283            let _field = rv.as_mut();
284
285            ::fidl_next::Decode::decode(rv.as_mut(), decoder_, ())?;
286
287            let _field = object.as_mut();
288
289            ::fidl_next::Decode::decode(object.as_mut(), decoder_, ())?;
290
291            Ok(())
292        }
293    }
294
295    impl ::fidl_next::IntoNatural for LoaderLoadObjectResponse {
296        type Natural = crate::natural::LoaderLoadObjectResponse;
297    }
298
299    impl ::fidl_next::Unconstrained for LoaderLoadObjectResponse {}
300
301    /// The wire type corresponding to [`LoaderCloneRequest`].
302    #[derive(Debug)]
303    #[repr(C)]
304    pub struct LoaderCloneRequest {
305        pub loader: ::fidl_next::ServerEnd<crate::Loader, ::fidl_next::fuchsia::WireChannel>,
306    }
307
308    static_assertions::const_assert_eq!(std::mem::size_of::<LoaderCloneRequest>(), 4);
309    static_assertions::const_assert_eq!(std::mem::align_of::<LoaderCloneRequest>(), 4);
310
311    static_assertions::const_assert_eq!(std::mem::offset_of!(LoaderCloneRequest, loader), 0);
312
313    unsafe impl ::fidl_next::Wire for LoaderCloneRequest {
314        type Owned<'de> = LoaderCloneRequest;
315
316        #[inline]
317        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
318            ::fidl_next::munge! {
319                let Self {
320
321                    loader,
322
323                } = &mut *out_;
324            }
325
326            ::fidl_next::Wire::zero_padding(loader);
327        }
328    }
329
330    unsafe impl<___D> ::fidl_next::Decode<___D> for LoaderCloneRequest
331    where
332        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
333        ___D: ::fidl_next::fuchsia::HandleDecoder,
334    {
335        fn decode(
336            slot_: ::fidl_next::Slot<'_, Self>,
337            decoder_: &mut ___D,
338            _: (),
339        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
340            ::fidl_next::munge! {
341                let Self {
342
343                    mut loader,
344
345                } = slot_;
346            }
347
348            let _field = loader.as_mut();
349
350            ::fidl_next::Decode::decode(loader.as_mut(), decoder_, ())?;
351
352            Ok(())
353        }
354    }
355
356    impl ::fidl_next::IntoNatural for LoaderCloneRequest {
357        type Natural = crate::natural::LoaderCloneRequest;
358    }
359
360    impl ::fidl_next::Unconstrained for LoaderCloneRequest {}
361}
362
363pub mod wire_optional {
364
365    pub use fidl_next_common_fuchsia_ldsvc::wire_optional::*;
366}
367
368pub mod generic {
369
370    pub use fidl_next_common_fuchsia_ldsvc::generic::*;
371
372    pub struct LoaderLoadObjectResponse<T0, T1> {
373        pub rv: T0,
374
375        pub object: T1,
376    }
377
378    unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::LoaderLoadObjectResponse, ___E>
379        for LoaderLoadObjectResponse<T0, T1>
380    where
381        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
382        ___E: ::fidl_next::fuchsia::HandleEncoder,
383        T0: ::fidl_next::Encode<::fidl_next::WireI32, ___E>,
384        T1: ::fidl_next::Encode<::fidl_next::fuchsia::WireOptionalVmo, ___E>,
385    {
386        #[inline]
387        fn encode(
388            self,
389            encoder_: &mut ___E,
390            out_: &mut ::core::mem::MaybeUninit<crate::wire::LoaderLoadObjectResponse>,
391            _: (),
392        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
393            ::fidl_next::munge! {
394                let crate::wire::LoaderLoadObjectResponse {
395
396                    rv,
397                    object,
398
399                } = out_;
400            }
401
402            ::fidl_next::Encode::encode(self.rv, encoder_, rv, ())?;
403
404            ::fidl_next::Encode::encode(self.object, encoder_, object, ())?;
405
406            Ok(())
407        }
408    }
409
410    pub struct LoaderCloneRequest<T0> {
411        pub loader: T0,
412    }
413
414    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::LoaderCloneRequest, ___E>
415        for LoaderCloneRequest<T0>
416    where
417        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
418        ___E: ::fidl_next::fuchsia::HandleEncoder,
419        T0: ::fidl_next::Encode<
420                ::fidl_next::ServerEnd<crate::Loader, ::fidl_next::fuchsia::WireChannel>,
421                ___E,
422            >,
423    {
424        #[inline]
425        fn encode(
426            self,
427            encoder_: &mut ___E,
428            out_: &mut ::core::mem::MaybeUninit<crate::wire::LoaderCloneRequest>,
429            _: (),
430        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
431            ::fidl_next::munge! {
432                let crate::wire::LoaderCloneRequest {
433
434                    loader,
435
436                } = out_;
437            }
438
439            ::fidl_next::Encode::encode(self.loader, encoder_, loader, ())?;
440
441            Ok(())
442        }
443    }
444}
445
446pub use self::natural::*;
447
448/// The type corresponding to the Loader protocol.
449#[doc = " See //docs/concepts/process/program_loading.md for a more complete\n description of this and related process bootstrapping protocols, and\n for specifics about the default global loader service\'s\n interpretation of names, paths, and configurations.\n"]
450#[derive(PartialEq, Debug)]
451pub struct Loader;
452
453#[cfg(target_os = "fuchsia")]
454impl ::fidl_next::HasTransport for Loader {
455    type Transport = ::fidl_next::fuchsia::zx::Channel;
456}
457
458pub mod loader {
459    pub mod prelude {
460        pub use crate::{Loader, LoaderClientHandler, LoaderServerHandler, loader};
461
462        pub use crate::natural::LoaderCloneRequest;
463
464        pub use crate::natural::LoaderCloneResponse;
465
466        pub use crate::natural::LoaderConfigRequest;
467
468        pub use crate::natural::LoaderConfigResponse;
469
470        pub use crate::natural::LoaderLoadObjectRequest;
471
472        pub use crate::natural::LoaderLoadObjectResponse;
473    }
474
475    pub struct Done;
476
477    impl ::fidl_next::Method for Done {
478        const ORDINAL: u64 = 7186174313520107521;
479        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
480            ::fidl_next::protocol::Flexibility::Strict;
481
482        type Protocol = crate::Loader;
483
484        type Request = ();
485    }
486
487    pub struct LoadObject;
488
489    impl ::fidl_next::Method for LoadObject {
490        const ORDINAL: u64 = 5243774714012182611;
491        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
492            ::fidl_next::protocol::Flexibility::Strict;
493
494        type Protocol = crate::Loader;
495
496        type Request = crate::wire::LoaderLoadObjectRequest<'static>;
497    }
498
499    impl ::fidl_next::TwoWayMethod for LoadObject {
500        type Response = crate::wire::LoaderLoadObjectResponse;
501    }
502
503    impl<___R> ::fidl_next::Respond<___R> for LoadObject {
504        type Output = ___R;
505
506        fn respond(response: ___R) -> Self::Output {
507            response
508        }
509    }
510
511    pub struct Config;
512
513    impl ::fidl_next::Method for Config {
514        const ORDINAL: u64 = 7676977189692319809;
515        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
516            ::fidl_next::protocol::Flexibility::Strict;
517
518        type Protocol = crate::Loader;
519
520        type Request = crate::wire::LoaderConfigRequest<'static>;
521    }
522
523    impl ::fidl_next::TwoWayMethod for Config {
524        type Response = crate::wire::LoaderConfigResponse;
525    }
526
527    impl<___R> ::fidl_next::Respond<___R> for Config {
528        type Output = crate::generic::LoaderConfigResponse<___R>;
529
530        fn respond(response: ___R) -> Self::Output {
531            crate::generic::LoaderConfigResponse { rv: response }
532        }
533    }
534
535    pub struct Clone;
536
537    impl ::fidl_next::Method for Clone {
538        const ORDINAL: u64 = 6333824321947847721;
539        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
540            ::fidl_next::protocol::Flexibility::Strict;
541
542        type Protocol = crate::Loader;
543
544        type Request = crate::wire::LoaderCloneRequest;
545    }
546
547    impl ::fidl_next::TwoWayMethod for Clone {
548        type Response = crate::wire::LoaderCloneResponse;
549    }
550
551    impl<___R> ::fidl_next::Respond<___R> for Clone {
552        type Output = crate::generic::LoaderCloneResponse<___R>;
553
554        fn respond(response: ___R) -> Self::Output {
555            crate::generic::LoaderCloneResponse { rv: response }
556        }
557    }
558
559    mod ___detail {
560        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Loader
561        where
562            ___T: ::fidl_next::Transport,
563        {
564            type Client = LoaderClient<___T>;
565            type Server = LoaderServer<___T>;
566        }
567
568        /// The client for the `Loader` protocol.
569        #[repr(transparent)]
570        pub struct LoaderClient<___T: ::fidl_next::Transport> {
571            #[allow(dead_code)]
572            client: ::fidl_next::protocol::Client<___T>,
573        }
574
575        impl<___T> LoaderClient<___T>
576        where
577            ___T: ::fidl_next::Transport,
578        {
579            #[doc = " Cleanly shutdown the connection to the Loader service.\n"]
580            pub fn done(&self) -> ::fidl_next::SendFuture<'_, ___T> {
581                ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
582                    7186174313520107521,
583                    <super::Done as ::fidl_next::Method>::FLEXIBILITY,
584                    (),
585                ))
586            }
587
588            #[doc = " The dynamic linker sends `object_name` and gets back a VMO\n handle containing the file.\n"]
589            pub fn load_object(
590                &self,
591
592                object_name: impl ::fidl_next::Encode<
593                    ::fidl_next::WireString<'static>,
594                    <___T as ::fidl_next::Transport>::SendBuffer,
595                >,
596            ) -> ::fidl_next::TwoWayFuture<'_, super::LoadObject, ___T>
597            where
598                <___T as ::fidl_next::Transport>::SendBuffer:
599                    ::fidl_next::encoder::InternalHandleEncoder,
600                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
601            {
602                self.load_object_with(crate::generic::LoaderLoadObjectRequest { object_name })
603            }
604
605            #[doc = " The dynamic linker sends `object_name` and gets back a VMO\n handle containing the file.\n"]
606            pub fn load_object_with<___R>(
607                &self,
608                request: ___R,
609            ) -> ::fidl_next::TwoWayFuture<'_, super::LoadObject, ___T>
610            where
611                ___R: ::fidl_next::Encode<
612                        crate::wire::LoaderLoadObjectRequest<'static>,
613                        <___T as ::fidl_next::Transport>::SendBuffer,
614                    >,
615            {
616                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
617                    5243774714012182611,
618                    <super::LoadObject as ::fidl_next::Method>::FLEXIBILITY,
619                    request,
620                ))
621            }
622
623            #[doc = " The dynamic linker sends a `config` identifying its load\n configuration.  This is intended to affect how later\n `LoadObject` requests decide what particular implementation\n file to supply for a given name.\n"]
624            pub fn config(
625                &self,
626
627                config: impl ::fidl_next::Encode<
628                    ::fidl_next::WireString<'static>,
629                    <___T as ::fidl_next::Transport>::SendBuffer,
630                >,
631            ) -> ::fidl_next::TwoWayFuture<'_, super::Config, ___T>
632            where
633                <___T as ::fidl_next::Transport>::SendBuffer:
634                    ::fidl_next::encoder::InternalHandleEncoder,
635                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
636            {
637                self.config_with(crate::generic::LoaderConfigRequest { config })
638            }
639
640            #[doc = " The dynamic linker sends a `config` identifying its load\n configuration.  This is intended to affect how later\n `LoadObject` requests decide what particular implementation\n file to supply for a given name.\n"]
641            pub fn config_with<___R>(
642                &self,
643                request: ___R,
644            ) -> ::fidl_next::TwoWayFuture<'_, super::Config, ___T>
645            where
646                ___R: ::fidl_next::Encode<
647                        crate::wire::LoaderConfigRequest<'static>,
648                        <___T as ::fidl_next::Transport>::SendBuffer,
649                    >,
650            {
651                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
652                    7676977189692319809,
653                    <super::Config as ::fidl_next::Method>::FLEXIBILITY,
654                    request,
655                ))
656            }
657
658            #[doc = " Obtain a new loader service connection.\n"]
659            pub fn clone(
660                &self,
661
662                loader: impl ::fidl_next::Encode<
663                    ::fidl_next::ServerEnd<crate::Loader, ::fidl_next::fuchsia::WireChannel>,
664                    <___T as ::fidl_next::Transport>::SendBuffer,
665                >,
666            ) -> ::fidl_next::TwoWayFuture<'_, super::Clone, ___T>
667            where
668                <___T as ::fidl_next::Transport>::SendBuffer:
669                    ::fidl_next::encoder::InternalHandleEncoder,
670                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
671            {
672                self.clone_with(crate::generic::LoaderCloneRequest { loader })
673            }
674
675            #[doc = " Obtain a new loader service connection.\n"]
676            pub fn clone_with<___R>(
677                &self,
678                request: ___R,
679            ) -> ::fidl_next::TwoWayFuture<'_, super::Clone, ___T>
680            where
681                ___R: ::fidl_next::Encode<
682                        crate::wire::LoaderCloneRequest,
683                        <___T as ::fidl_next::Transport>::SendBuffer,
684                    >,
685            {
686                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
687                    6333824321947847721,
688                    <super::Clone as ::fidl_next::Method>::FLEXIBILITY,
689                    request,
690                ))
691            }
692        }
693
694        /// The server for the `Loader` protocol.
695        #[repr(transparent)]
696        pub struct LoaderServer<___T: ::fidl_next::Transport> {
697            server: ::fidl_next::protocol::Server<___T>,
698        }
699
700        impl<___T> LoaderServer<___T> where ___T: ::fidl_next::Transport {}
701    }
702}
703
704/// A client handler for the Loader protocol.
705///
706/// See [`Loader`] for more details.
707pub trait LoaderClientHandler<
708    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
709    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
710>
711{
712}
713
714impl<___T> LoaderClientHandler<___T> for ::fidl_next::IgnoreEvents where ___T: ::fidl_next::Transport
715{}
716
717impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Loader
718where
719    ___H: LoaderClientHandler<___T> + ::core::marker::Send,
720    ___T: ::fidl_next::Transport,
721{
722    async fn on_event(
723        handler: &mut ___H,
724        ordinal: u64,
725        flexibility: ::fidl_next::protocol::Flexibility,
726        buffer: ___T::RecvBuffer,
727    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
728        match ordinal {
729            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
730        }
731    }
732}
733
734/// A server handler for the Loader protocol.
735///
736/// See [`Loader`] for more details.
737pub trait LoaderServerHandler<
738    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
739    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
740>
741{
742    #[doc = " Cleanly shutdown the connection to the Loader service.\n"]
743    fn done(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
744
745    #[doc = " The dynamic linker sends `object_name` and gets back a VMO\n handle containing the file.\n"]
746    fn load_object(
747        &mut self,
748
749        request: ::fidl_next::Request<loader::LoadObject, ___T>,
750
751        responder: ::fidl_next::Responder<loader::LoadObject, ___T>,
752    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
753
754    #[doc = " The dynamic linker sends a `config` identifying its load\n configuration.  This is intended to affect how later\n `LoadObject` requests decide what particular implementation\n file to supply for a given name.\n"]
755    fn config(
756        &mut self,
757
758        request: ::fidl_next::Request<loader::Config, ___T>,
759
760        responder: ::fidl_next::Responder<loader::Config, ___T>,
761    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
762
763    #[doc = " Obtain a new loader service connection.\n"]
764    fn clone(
765        &mut self,
766
767        request: ::fidl_next::Request<loader::Clone, ___T>,
768
769        responder: ::fidl_next::Responder<loader::Clone, ___T>,
770    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
771}
772
773impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Loader
774where
775    ___H: LoaderServerHandler<___T> + ::core::marker::Send,
776    ___T: ::fidl_next::Transport,
777    <loader::LoadObject as ::fidl_next::Method>::Request:
778        ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
779    <loader::Config as ::fidl_next::Method>::Request:
780        ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
781    <loader::Clone as ::fidl_next::Method>::Request:
782        ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
783{
784    async fn on_one_way(
785        handler: &mut ___H,
786        ordinal: u64,
787        flexibility: ::fidl_next::protocol::Flexibility,
788        buffer: ___T::RecvBuffer,
789    ) -> ::core::result::Result<
790        (),
791        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
792    > {
793        match ordinal {
794            7186174313520107521 => {
795                handler.done().await;
796                Ok(())
797            }
798
799            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
800        }
801    }
802
803    async fn on_two_way(
804        handler: &mut ___H,
805        ordinal: u64,
806        flexibility: ::fidl_next::protocol::Flexibility,
807        buffer: ___T::RecvBuffer,
808        responder: ::fidl_next::protocol::Responder<___T>,
809    ) -> ::core::result::Result<
810        (),
811        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
812    > {
813        match ordinal {
814            5243774714012182611 => {
815                let responder = ::fidl_next::Responder::from_untyped(responder);
816
817                match ::fidl_next::DecoderExt::decode(buffer) {
818                    Ok(decoded) => {
819                        handler
820                            .load_object(::fidl_next::Request::from_decoded(decoded), responder)
821                            .await;
822                        Ok(())
823                    }
824                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
825                        ordinal: 5243774714012182611,
826                        error,
827                    }),
828                }
829            }
830
831            7676977189692319809 => {
832                let responder = ::fidl_next::Responder::from_untyped(responder);
833
834                match ::fidl_next::DecoderExt::decode(buffer) {
835                    Ok(decoded) => {
836                        handler
837                            .config(::fidl_next::Request::from_decoded(decoded), responder)
838                            .await;
839                        Ok(())
840                    }
841                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
842                        ordinal: 7676977189692319809,
843                        error,
844                    }),
845                }
846            }
847
848            6333824321947847721 => {
849                let responder = ::fidl_next::Responder::from_untyped(responder);
850
851                match ::fidl_next::DecoderExt::decode(buffer) {
852                    Ok(decoded) => {
853                        handler.clone(::fidl_next::Request::from_decoded(decoded), responder).await;
854                        Ok(())
855                    }
856                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
857                        ordinal: 6333824321947847721,
858                        error,
859                    }),
860                }
861            }
862
863            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
864        }
865    }
866}
867
868pub use fidl_next_common_fuchsia_ldsvc::*;
869
870/// Compatibility shims which mimic some API surfaces of the current Rust bindings.
871pub mod compat {
872
873    pub use fidl_next_common_fuchsia_ldsvc::compat::*;
874
875    impl ::fidl_next::CompatFrom<crate::LoaderLoadObjectResponse>
876        for ::fidl_fuchsia_ldsvc::LoaderLoadObjectResponse
877    {
878        #[inline]
879        fn compat_from(value: crate::LoaderLoadObjectResponse) -> Self {
880            Self {
881                rv: ::fidl_next::CompatFrom::compat_from(value.rv),
882
883                object: ::fidl_next::CompatFrom::compat_from(value.object),
884            }
885        }
886    }
887
888    impl ::fidl_next::CompatFrom<::fidl_fuchsia_ldsvc::LoaderLoadObjectResponse>
889        for crate::LoaderLoadObjectResponse
890    {
891        #[inline]
892        fn compat_from(value: ::fidl_fuchsia_ldsvc::LoaderLoadObjectResponse) -> Self {
893            Self {
894                rv: ::fidl_next::CompatFrom::compat_from(value.rv),
895
896                object: ::fidl_next::CompatFrom::compat_from(value.object),
897            }
898        }
899    }
900
901    impl ::fidl_next::CompatFrom<crate::LoaderCloneRequest>
902        for ::fidl_fuchsia_ldsvc::LoaderCloneRequest
903    {
904        #[inline]
905        fn compat_from(value: crate::LoaderCloneRequest) -> Self {
906            Self { loader: ::fidl_next::CompatFrom::compat_from(value.loader) }
907        }
908    }
909
910    impl ::fidl_next::CompatFrom<::fidl_fuchsia_ldsvc::LoaderCloneRequest>
911        for crate::LoaderCloneRequest
912    {
913        #[inline]
914        fn compat_from(value: ::fidl_fuchsia_ldsvc::LoaderCloneRequest) -> Self {
915            Self { loader: ::fidl_next::CompatFrom::compat_from(value.loader) }
916        }
917    }
918
919    #[cfg(target_os = "fuchsia")]
920    /// An alias for a client over `zx::Channel` for the `Loader`
921    /// protocol.
922    pub type LoaderProxy = ::fidl_next::Client<crate::Loader>;
923
924    impl ::fidl_next::CompatFrom<crate::Loader> for ::fidl_fuchsia_ldsvc::LoaderMarker {
925        fn compat_from(_: crate::Loader) -> Self {
926            Self
927        }
928    }
929
930    impl ::fidl_next::CompatFrom<::fidl_fuchsia_ldsvc::LoaderMarker> for crate::Loader {
931        fn compat_from(_: ::fidl_fuchsia_ldsvc::LoaderMarker) -> Self {
932            Self
933        }
934    }
935
936    #[cfg(target_os = "fuchsia")]
937
938    impl ::fidl_next::ClientCompatFrom<::fidl_fuchsia_ldsvc::LoaderProxy> for crate::Loader {
939        fn client_compat_from(
940            proxy: ::fidl_fuchsia_ldsvc::LoaderProxy,
941        ) -> ::fidl_next::ClientDispatcher<Self, ::fidl_next::fuchsia::zx::Channel> {
942            let channel = ::fidl::endpoints::Proxy::into_channel(proxy).unwrap().into_zx_channel();
943            let client_end = ::fidl_next::ClientEnd::from_untyped(channel);
944            ::fidl_next::ClientDispatcher::new(client_end)
945        }
946    }
947}