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<fidl::encoding::Vector<fidl::encoding::BoundedString<132>, 32>, D>,
73    > fidl::encoding::Encode<ContextGetEnvironResponse, D> for (T0,)
74    {
75        #[inline]
76        unsafe fn encode(
77            self,
78            encoder: &mut fidl::encoding::Encoder<'_, D>,
79            offset: usize,
80            depth: fidl::encoding::Depth,
81        ) -> fidl::Result<()> {
82            encoder.debug_check_bounds::<ContextGetEnvironResponse>(offset);
83            // Zero out padding regions. There's no need to apply masks
84            // because the unmasked parts will be overwritten by fields.
85            // Write the fields.
86            self.0.encode(encoder, offset + 0, depth)?;
87            Ok(())
88        }
89    }
90
91    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
92        for ContextGetEnvironResponse
93    {
94        #[inline(always)]
95        fn new_empty() -> Self {
96            Self {
97                environ: fidl::new_empty!(
98                    fidl::encoding::Vector<fidl::encoding::BoundedString<132>, 32>,
99                    D
100                ),
101            }
102        }
103
104        #[inline]
105        unsafe fn decode(
106            &mut self,
107            decoder: &mut fidl::encoding::Decoder<'_, D>,
108            offset: usize,
109            _depth: fidl::encoding::Depth,
110        ) -> fidl::Result<()> {
111            decoder.debug_check_bounds::<Self>(offset);
112            // Verify that padding bytes are zero.
113            fidl::decode!(
114                fidl::encoding::Vector<fidl::encoding::BoundedString<132>, 32>,
115                D,
116                &mut self.environ,
117                decoder,
118                offset + 0,
119                _depth
120            )?;
121            Ok(())
122        }
123    }
124}