fidl_test_placeholders__common/
fidl_test_placeholders__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, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12pub struct EchoEchoStringRequest {
13    pub value: Option<String>,
14}
15
16impl fidl::Persistable for EchoEchoStringRequest {}
17
18#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
19pub struct EchoEchoStringResponse {
20    pub response: Option<String>,
21}
22
23impl fidl::Persistable for EchoEchoStringResponse {}
24
25pub mod echo_ordinals {
26    pub const ECHO_STRING: u64 = 0x39f9ac471d0ec540;
27}
28
29mod internal {
30    use super::*;
31
32    impl fidl::encoding::ValueTypeMarker for EchoEchoStringRequest {
33        type Borrowed<'a> = &'a Self;
34        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
35            value
36        }
37    }
38
39    unsafe impl fidl::encoding::TypeMarker for EchoEchoStringRequest {
40        type Owned = Self;
41
42        #[inline(always)]
43        fn inline_align(_context: fidl::encoding::Context) -> usize {
44            8
45        }
46
47        #[inline(always)]
48        fn inline_size(_context: fidl::encoding::Context) -> usize {
49            16
50        }
51    }
52
53    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EchoEchoStringRequest, D>
54        for &EchoEchoStringRequest
55    {
56        #[inline]
57        unsafe fn encode(
58            self,
59            encoder: &mut fidl::encoding::Encoder<'_, D>,
60            offset: usize,
61            _depth: fidl::encoding::Depth,
62        ) -> fidl::Result<()> {
63            encoder.debug_check_bounds::<EchoEchoStringRequest>(offset);
64            // Delegate to tuple encoding.
65            fidl::encoding::Encode::<EchoEchoStringRequest, D>::encode(
66                (
67                    <fidl::encoding::Optional<fidl::encoding::BoundedString<2048>> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
68                ),
69                encoder, offset, _depth
70            )
71        }
72    }
73    unsafe impl<
74            D: fidl::encoding::ResourceDialect,
75            T0: fidl::encoding::Encode<
76                fidl::encoding::Optional<fidl::encoding::BoundedString<2048>>,
77                D,
78            >,
79        > fidl::encoding::Encode<EchoEchoStringRequest, D> for (T0,)
80    {
81        #[inline]
82        unsafe fn encode(
83            self,
84            encoder: &mut fidl::encoding::Encoder<'_, D>,
85            offset: usize,
86            depth: fidl::encoding::Depth,
87        ) -> fidl::Result<()> {
88            encoder.debug_check_bounds::<EchoEchoStringRequest>(offset);
89            // Zero out padding regions. There's no need to apply masks
90            // because the unmasked parts will be overwritten by fields.
91            // Write the fields.
92            self.0.encode(encoder, offset + 0, depth)?;
93            Ok(())
94        }
95    }
96
97    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EchoEchoStringRequest {
98        #[inline(always)]
99        fn new_empty() -> Self {
100            Self {
101                value: fidl::new_empty!(
102                    fidl::encoding::Optional<fidl::encoding::BoundedString<2048>>,
103                    D
104                ),
105            }
106        }
107
108        #[inline]
109        unsafe fn decode(
110            &mut self,
111            decoder: &mut fidl::encoding::Decoder<'_, D>,
112            offset: usize,
113            _depth: fidl::encoding::Depth,
114        ) -> fidl::Result<()> {
115            decoder.debug_check_bounds::<Self>(offset);
116            // Verify that padding bytes are zero.
117            fidl::decode!(
118                fidl::encoding::Optional<fidl::encoding::BoundedString<2048>>,
119                D,
120                &mut self.value,
121                decoder,
122                offset + 0,
123                _depth
124            )?;
125            Ok(())
126        }
127    }
128
129    impl fidl::encoding::ValueTypeMarker for EchoEchoStringResponse {
130        type Borrowed<'a> = &'a Self;
131        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
132            value
133        }
134    }
135
136    unsafe impl fidl::encoding::TypeMarker for EchoEchoStringResponse {
137        type Owned = Self;
138
139        #[inline(always)]
140        fn inline_align(_context: fidl::encoding::Context) -> usize {
141            8
142        }
143
144        #[inline(always)]
145        fn inline_size(_context: fidl::encoding::Context) -> usize {
146            16
147        }
148    }
149
150    unsafe impl<D: fidl::encoding::ResourceDialect>
151        fidl::encoding::Encode<EchoEchoStringResponse, D> for &EchoEchoStringResponse
152    {
153        #[inline]
154        unsafe fn encode(
155            self,
156            encoder: &mut fidl::encoding::Encoder<'_, D>,
157            offset: usize,
158            _depth: fidl::encoding::Depth,
159        ) -> fidl::Result<()> {
160            encoder.debug_check_bounds::<EchoEchoStringResponse>(offset);
161            // Delegate to tuple encoding.
162            fidl::encoding::Encode::<EchoEchoStringResponse, D>::encode(
163                (
164                    <fidl::encoding::Optional<fidl::encoding::BoundedString<2048>> as fidl::encoding::ValueTypeMarker>::borrow(&self.response),
165                ),
166                encoder, offset, _depth
167            )
168        }
169    }
170    unsafe impl<
171            D: fidl::encoding::ResourceDialect,
172            T0: fidl::encoding::Encode<
173                fidl::encoding::Optional<fidl::encoding::BoundedString<2048>>,
174                D,
175            >,
176        > fidl::encoding::Encode<EchoEchoStringResponse, D> for (T0,)
177    {
178        #[inline]
179        unsafe fn encode(
180            self,
181            encoder: &mut fidl::encoding::Encoder<'_, D>,
182            offset: usize,
183            depth: fidl::encoding::Depth,
184        ) -> fidl::Result<()> {
185            encoder.debug_check_bounds::<EchoEchoStringResponse>(offset);
186            // Zero out padding regions. There's no need to apply masks
187            // because the unmasked parts will be overwritten by fields.
188            // Write the fields.
189            self.0.encode(encoder, offset + 0, depth)?;
190            Ok(())
191        }
192    }
193
194    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
195        for EchoEchoStringResponse
196    {
197        #[inline(always)]
198        fn new_empty() -> Self {
199            Self {
200                response: fidl::new_empty!(
201                    fidl::encoding::Optional<fidl::encoding::BoundedString<2048>>,
202                    D
203                ),
204            }
205        }
206
207        #[inline]
208        unsafe fn decode(
209            &mut self,
210            decoder: &mut fidl::encoding::Decoder<'_, D>,
211            offset: usize,
212            _depth: fidl::encoding::Depth,
213        ) -> fidl::Result<()> {
214            decoder.debug_check_bounds::<Self>(offset);
215            // Verify that padding bytes are zero.
216            fidl::decode!(
217                fidl::encoding::Optional<fidl::encoding::BoundedString<2048>>,
218                D,
219                &mut self.response,
220                decoder,
221                offset + 0,
222                _depth
223            )?;
224            Ok(())
225        }
226    }
227}