fidl_fuchsia_elf_test__common/
fidl_fuchsia_elf_test__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
11pub const MAX_ENV_VARS: i32 = 32;
12
13pub const MAX_VAR_LEN: i32 = 132;
14
15#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
16pub struct ContextGetEnvironResponse {
17    pub environ: Vec<String>,
18}
19
20impl fidl::Persistable for ContextGetEnvironResponse {}
21
22pub mod context_ordinals {
23    pub const GET_ENVIRON: u64 = 0x29ded28f9660a178;
24}
25
26mod internal {
27    use super::*;
28
29    impl fidl::encoding::ValueTypeMarker for ContextGetEnvironResponse {
30        type Borrowed<'a> = &'a Self;
31        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
32            value
33        }
34    }
35
36    unsafe impl fidl::encoding::TypeMarker for ContextGetEnvironResponse {
37        type Owned = Self;
38
39        #[inline(always)]
40        fn inline_align(_context: fidl::encoding::Context) -> usize {
41            8
42        }
43
44        #[inline(always)]
45        fn inline_size(_context: fidl::encoding::Context) -> usize {
46            16
47        }
48    }
49
50    unsafe impl<D: fidl::encoding::ResourceDialect>
51        fidl::encoding::Encode<ContextGetEnvironResponse, D> for &ContextGetEnvironResponse
52    {
53        #[inline]
54        unsafe fn encode(
55            self,
56            encoder: &mut fidl::encoding::Encoder<'_, D>,
57            offset: usize,
58            _depth: fidl::encoding::Depth,
59        ) -> fidl::Result<()> {
60            encoder.debug_check_bounds::<ContextGetEnvironResponse>(offset);
61            // Delegate to tuple encoding.
62            fidl::encoding::Encode::<ContextGetEnvironResponse, D>::encode(
63                (
64                    <fidl::encoding::Vector<fidl::encoding::BoundedString<132>, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.environ),
65                ),
66                encoder, offset, _depth
67            )
68        }
69    }
70    unsafe impl<
71            D: fidl::encoding::ResourceDialect,
72            T0: fidl::encoding::Encode<
73                fidl::encoding::Vector<fidl::encoding::BoundedString<132>, 32>,
74                D,
75            >,
76        > fidl::encoding::Encode<ContextGetEnvironResponse, D> for (T0,)
77    {
78        #[inline]
79        unsafe fn encode(
80            self,
81            encoder: &mut fidl::encoding::Encoder<'_, D>,
82            offset: usize,
83            depth: fidl::encoding::Depth,
84        ) -> fidl::Result<()> {
85            encoder.debug_check_bounds::<ContextGetEnvironResponse>(offset);
86            // Zero out padding regions. There's no need to apply masks
87            // because the unmasked parts will be overwritten by fields.
88            // Write the fields.
89            self.0.encode(encoder, offset + 0, depth)?;
90            Ok(())
91        }
92    }
93
94    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
95        for ContextGetEnvironResponse
96    {
97        #[inline(always)]
98        fn new_empty() -> Self {
99            Self {
100                environ: fidl::new_empty!(
101                    fidl::encoding::Vector<fidl::encoding::BoundedString<132>, 32>,
102                    D
103                ),
104            }
105        }
106
107        #[inline]
108        unsafe fn decode(
109            &mut self,
110            decoder: &mut fidl::encoding::Decoder<'_, D>,
111            offset: usize,
112            _depth: fidl::encoding::Depth,
113        ) -> fidl::Result<()> {
114            decoder.debug_check_bounds::<Self>(offset);
115            // Verify that padding bytes are zero.
116            fidl::decode!(
117                fidl::encoding::Vector<fidl::encoding::BoundedString<132>, 32>,
118                D,
119                &mut self.environ,
120                decoder,
121                offset + 0,
122                _depth
123            )?;
124            Ok(())
125        }
126    }
127}