fidl_fuchsia_ldsvc__common/
fidl_fuchsia_ldsvc__common.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::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12#[repr(C)]
13pub struct LoaderCloneResponse {
14    pub rv: i32,
15}
16
17impl fidl::Persistable for LoaderCloneResponse {}
18
19#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
20pub struct LoaderConfigRequest {
21    pub config: String,
22}
23
24impl fidl::Persistable for LoaderConfigRequest {}
25
26#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
27#[repr(C)]
28pub struct LoaderConfigResponse {
29    pub rv: i32,
30}
31
32impl fidl::Persistable for LoaderConfigResponse {}
33
34#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
35pub struct LoaderLoadObjectRequest {
36    pub object_name: String,
37}
38
39impl fidl::Persistable for LoaderLoadObjectRequest {}
40
41pub mod loader_ordinals {
42    pub const DONE: u64 = 0x63ba6b76d3671001;
43    pub const LOAD_OBJECT: u64 = 0x48c5a151d6df2853;
44    pub const CONFIG: u64 = 0x6a8a1a1464632841;
45    pub const CLONE: u64 = 0x57e643a9ab6e4c29;
46}
47
48mod internal {
49    use super::*;
50
51    impl fidl::encoding::ValueTypeMarker for LoaderCloneResponse {
52        type Borrowed<'a> = &'a Self;
53        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
54            value
55        }
56    }
57
58    unsafe impl fidl::encoding::TypeMarker for LoaderCloneResponse {
59        type Owned = Self;
60
61        #[inline(always)]
62        fn inline_align(_context: fidl::encoding::Context) -> usize {
63            4
64        }
65
66        #[inline(always)]
67        fn inline_size(_context: fidl::encoding::Context) -> usize {
68            4
69        }
70        #[inline(always)]
71        fn encode_is_copy() -> bool {
72            true
73        }
74
75        #[inline(always)]
76        fn decode_is_copy() -> bool {
77            true
78        }
79    }
80
81    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LoaderCloneResponse, D>
82        for &LoaderCloneResponse
83    {
84        #[inline]
85        unsafe fn encode(
86            self,
87            encoder: &mut fidl::encoding::Encoder<'_, D>,
88            offset: usize,
89            _depth: fidl::encoding::Depth,
90        ) -> fidl::Result<()> {
91            encoder.debug_check_bounds::<LoaderCloneResponse>(offset);
92            unsafe {
93                // Copy the object into the buffer.
94                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
95                (buf_ptr as *mut LoaderCloneResponse)
96                    .write_unaligned((self as *const LoaderCloneResponse).read());
97                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
98                // done second because the memcpy will write garbage to these bytes.
99            }
100            Ok(())
101        }
102    }
103    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
104        fidl::encoding::Encode<LoaderCloneResponse, D> for (T0,)
105    {
106        #[inline]
107        unsafe fn encode(
108            self,
109            encoder: &mut fidl::encoding::Encoder<'_, D>,
110            offset: usize,
111            depth: fidl::encoding::Depth,
112        ) -> fidl::Result<()> {
113            encoder.debug_check_bounds::<LoaderCloneResponse>(offset);
114            // Zero out padding regions. There's no need to apply masks
115            // because the unmasked parts will be overwritten by fields.
116            // Write the fields.
117            self.0.encode(encoder, offset + 0, depth)?;
118            Ok(())
119        }
120    }
121
122    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LoaderCloneResponse {
123        #[inline(always)]
124        fn new_empty() -> Self {
125            Self { rv: fidl::new_empty!(i32, D) }
126        }
127
128        #[inline]
129        unsafe fn decode(
130            &mut self,
131            decoder: &mut fidl::encoding::Decoder<'_, D>,
132            offset: usize,
133            _depth: fidl::encoding::Depth,
134        ) -> fidl::Result<()> {
135            decoder.debug_check_bounds::<Self>(offset);
136            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
137            // Verify that padding bytes are zero.
138            // Copy from the buffer into the object.
139            unsafe {
140                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
141            }
142            Ok(())
143        }
144    }
145
146    impl fidl::encoding::ValueTypeMarker for LoaderConfigRequest {
147        type Borrowed<'a> = &'a Self;
148        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
149            value
150        }
151    }
152
153    unsafe impl fidl::encoding::TypeMarker for LoaderConfigRequest {
154        type Owned = Self;
155
156        #[inline(always)]
157        fn inline_align(_context: fidl::encoding::Context) -> usize {
158            8
159        }
160
161        #[inline(always)]
162        fn inline_size(_context: fidl::encoding::Context) -> usize {
163            16
164        }
165    }
166
167    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LoaderConfigRequest, D>
168        for &LoaderConfigRequest
169    {
170        #[inline]
171        unsafe fn encode(
172            self,
173            encoder: &mut fidl::encoding::Encoder<'_, D>,
174            offset: usize,
175            _depth: fidl::encoding::Depth,
176        ) -> fidl::Result<()> {
177            encoder.debug_check_bounds::<LoaderConfigRequest>(offset);
178            // Delegate to tuple encoding.
179            fidl::encoding::Encode::<LoaderConfigRequest, D>::encode(
180                (<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(
181                    &self.config,
182                ),),
183                encoder,
184                offset,
185                _depth,
186            )
187        }
188    }
189    unsafe impl<
190            D: fidl::encoding::ResourceDialect,
191            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<1024>, D>,
192        > fidl::encoding::Encode<LoaderConfigRequest, D> for (T0,)
193    {
194        #[inline]
195        unsafe fn encode(
196            self,
197            encoder: &mut fidl::encoding::Encoder<'_, D>,
198            offset: usize,
199            depth: fidl::encoding::Depth,
200        ) -> fidl::Result<()> {
201            encoder.debug_check_bounds::<LoaderConfigRequest>(offset);
202            // Zero out padding regions. There's no need to apply masks
203            // because the unmasked parts will be overwritten by fields.
204            // Write the fields.
205            self.0.encode(encoder, offset + 0, depth)?;
206            Ok(())
207        }
208    }
209
210    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LoaderConfigRequest {
211        #[inline(always)]
212        fn new_empty() -> Self {
213            Self { config: fidl::new_empty!(fidl::encoding::BoundedString<1024>, D) }
214        }
215
216        #[inline]
217        unsafe fn decode(
218            &mut self,
219            decoder: &mut fidl::encoding::Decoder<'_, D>,
220            offset: usize,
221            _depth: fidl::encoding::Depth,
222        ) -> fidl::Result<()> {
223            decoder.debug_check_bounds::<Self>(offset);
224            // Verify that padding bytes are zero.
225            fidl::decode!(
226                fidl::encoding::BoundedString<1024>,
227                D,
228                &mut self.config,
229                decoder,
230                offset + 0,
231                _depth
232            )?;
233            Ok(())
234        }
235    }
236
237    impl fidl::encoding::ValueTypeMarker for LoaderConfigResponse {
238        type Borrowed<'a> = &'a Self;
239        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
240            value
241        }
242    }
243
244    unsafe impl fidl::encoding::TypeMarker for LoaderConfigResponse {
245        type Owned = Self;
246
247        #[inline(always)]
248        fn inline_align(_context: fidl::encoding::Context) -> usize {
249            4
250        }
251
252        #[inline(always)]
253        fn inline_size(_context: fidl::encoding::Context) -> usize {
254            4
255        }
256        #[inline(always)]
257        fn encode_is_copy() -> bool {
258            true
259        }
260
261        #[inline(always)]
262        fn decode_is_copy() -> bool {
263            true
264        }
265    }
266
267    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LoaderConfigResponse, D>
268        for &LoaderConfigResponse
269    {
270        #[inline]
271        unsafe fn encode(
272            self,
273            encoder: &mut fidl::encoding::Encoder<'_, D>,
274            offset: usize,
275            _depth: fidl::encoding::Depth,
276        ) -> fidl::Result<()> {
277            encoder.debug_check_bounds::<LoaderConfigResponse>(offset);
278            unsafe {
279                // Copy the object into the buffer.
280                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
281                (buf_ptr as *mut LoaderConfigResponse)
282                    .write_unaligned((self as *const LoaderConfigResponse).read());
283                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
284                // done second because the memcpy will write garbage to these bytes.
285            }
286            Ok(())
287        }
288    }
289    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
290        fidl::encoding::Encode<LoaderConfigResponse, D> for (T0,)
291    {
292        #[inline]
293        unsafe fn encode(
294            self,
295            encoder: &mut fidl::encoding::Encoder<'_, D>,
296            offset: usize,
297            depth: fidl::encoding::Depth,
298        ) -> fidl::Result<()> {
299            encoder.debug_check_bounds::<LoaderConfigResponse>(offset);
300            // Zero out padding regions. There's no need to apply masks
301            // because the unmasked parts will be overwritten by fields.
302            // Write the fields.
303            self.0.encode(encoder, offset + 0, depth)?;
304            Ok(())
305        }
306    }
307
308    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LoaderConfigResponse {
309        #[inline(always)]
310        fn new_empty() -> Self {
311            Self { rv: fidl::new_empty!(i32, D) }
312        }
313
314        #[inline]
315        unsafe fn decode(
316            &mut self,
317            decoder: &mut fidl::encoding::Decoder<'_, D>,
318            offset: usize,
319            _depth: fidl::encoding::Depth,
320        ) -> fidl::Result<()> {
321            decoder.debug_check_bounds::<Self>(offset);
322            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
323            // Verify that padding bytes are zero.
324            // Copy from the buffer into the object.
325            unsafe {
326                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
327            }
328            Ok(())
329        }
330    }
331
332    impl fidl::encoding::ValueTypeMarker for LoaderLoadObjectRequest {
333        type Borrowed<'a> = &'a Self;
334        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
335            value
336        }
337    }
338
339    unsafe impl fidl::encoding::TypeMarker for LoaderLoadObjectRequest {
340        type Owned = Self;
341
342        #[inline(always)]
343        fn inline_align(_context: fidl::encoding::Context) -> usize {
344            8
345        }
346
347        #[inline(always)]
348        fn inline_size(_context: fidl::encoding::Context) -> usize {
349            16
350        }
351    }
352
353    unsafe impl<D: fidl::encoding::ResourceDialect>
354        fidl::encoding::Encode<LoaderLoadObjectRequest, D> for &LoaderLoadObjectRequest
355    {
356        #[inline]
357        unsafe fn encode(
358            self,
359            encoder: &mut fidl::encoding::Encoder<'_, D>,
360            offset: usize,
361            _depth: fidl::encoding::Depth,
362        ) -> fidl::Result<()> {
363            encoder.debug_check_bounds::<LoaderLoadObjectRequest>(offset);
364            // Delegate to tuple encoding.
365            fidl::encoding::Encode::<LoaderLoadObjectRequest, D>::encode(
366                (<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(
367                    &self.object_name,
368                ),),
369                encoder,
370                offset,
371                _depth,
372            )
373        }
374    }
375    unsafe impl<
376            D: fidl::encoding::ResourceDialect,
377            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<1024>, D>,
378        > fidl::encoding::Encode<LoaderLoadObjectRequest, D> for (T0,)
379    {
380        #[inline]
381        unsafe fn encode(
382            self,
383            encoder: &mut fidl::encoding::Encoder<'_, D>,
384            offset: usize,
385            depth: fidl::encoding::Depth,
386        ) -> fidl::Result<()> {
387            encoder.debug_check_bounds::<LoaderLoadObjectRequest>(offset);
388            // Zero out padding regions. There's no need to apply masks
389            // because the unmasked parts will be overwritten by fields.
390            // Write the fields.
391            self.0.encode(encoder, offset + 0, depth)?;
392            Ok(())
393        }
394    }
395
396    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
397        for LoaderLoadObjectRequest
398    {
399        #[inline(always)]
400        fn new_empty() -> Self {
401            Self { object_name: fidl::new_empty!(fidl::encoding::BoundedString<1024>, D) }
402        }
403
404        #[inline]
405        unsafe fn decode(
406            &mut self,
407            decoder: &mut fidl::encoding::Decoder<'_, D>,
408            offset: usize,
409            _depth: fidl::encoding::Depth,
410        ) -> fidl::Result<()> {
411            decoder.debug_check_bounds::<Self>(offset);
412            // Verify that padding bytes are zero.
413            fidl::decode!(
414                fidl::encoding::BoundedString<1024>,
415                D,
416                &mut self.object_name,
417                decoder,
418                offset + 0,
419                _depth
420            )?;
421            Ok(())
422        }
423    }
424}