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