fidl_test_echo__common/
fidl_test_echo__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 = 0x1e16cc1b194790f6;
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::UnboundedString> 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<fidl::encoding::Optional<fidl::encoding::UnboundedString>, D>,
76        > fidl::encoding::Encode<EchoEchoStringRequest, 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::<EchoEchoStringRequest>(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> for EchoEchoStringRequest {
95        #[inline(always)]
96        fn new_empty() -> Self {
97            Self {
98                value: fidl::new_empty!(
99                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
100                    D
101                ),
102            }
103        }
104
105        #[inline]
106        unsafe fn decode(
107            &mut self,
108            decoder: &mut fidl::encoding::Decoder<'_, D>,
109            offset: usize,
110            _depth: fidl::encoding::Depth,
111        ) -> fidl::Result<()> {
112            decoder.debug_check_bounds::<Self>(offset);
113            // Verify that padding bytes are zero.
114            fidl::decode!(
115                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
116                D,
117                &mut self.value,
118                decoder,
119                offset + 0,
120                _depth
121            )?;
122            Ok(())
123        }
124    }
125
126    impl fidl::encoding::ValueTypeMarker for EchoEchoStringResponse {
127        type Borrowed<'a> = &'a Self;
128        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
129            value
130        }
131    }
132
133    unsafe impl fidl::encoding::TypeMarker for EchoEchoStringResponse {
134        type Owned = Self;
135
136        #[inline(always)]
137        fn inline_align(_context: fidl::encoding::Context) -> usize {
138            8
139        }
140
141        #[inline(always)]
142        fn inline_size(_context: fidl::encoding::Context) -> usize {
143            16
144        }
145    }
146
147    unsafe impl<D: fidl::encoding::ResourceDialect>
148        fidl::encoding::Encode<EchoEchoStringResponse, D> for &EchoEchoStringResponse
149    {
150        #[inline]
151        unsafe fn encode(
152            self,
153            encoder: &mut fidl::encoding::Encoder<'_, D>,
154            offset: usize,
155            _depth: fidl::encoding::Depth,
156        ) -> fidl::Result<()> {
157            encoder.debug_check_bounds::<EchoEchoStringResponse>(offset);
158            // Delegate to tuple encoding.
159            fidl::encoding::Encode::<EchoEchoStringResponse, D>::encode(
160                (
161                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.response),
162                ),
163                encoder, offset, _depth
164            )
165        }
166    }
167    unsafe impl<
168            D: fidl::encoding::ResourceDialect,
169            T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::UnboundedString>, D>,
170        > fidl::encoding::Encode<EchoEchoStringResponse, D> for (T0,)
171    {
172        #[inline]
173        unsafe fn encode(
174            self,
175            encoder: &mut fidl::encoding::Encoder<'_, D>,
176            offset: usize,
177            depth: fidl::encoding::Depth,
178        ) -> fidl::Result<()> {
179            encoder.debug_check_bounds::<EchoEchoStringResponse>(offset);
180            // Zero out padding regions. There's no need to apply masks
181            // because the unmasked parts will be overwritten by fields.
182            // Write the fields.
183            self.0.encode(encoder, offset + 0, depth)?;
184            Ok(())
185        }
186    }
187
188    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
189        for EchoEchoStringResponse
190    {
191        #[inline(always)]
192        fn new_empty() -> Self {
193            Self {
194                response: fidl::new_empty!(
195                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
196                    D
197                ),
198            }
199        }
200
201        #[inline]
202        unsafe fn decode(
203            &mut self,
204            decoder: &mut fidl::encoding::Decoder<'_, D>,
205            offset: usize,
206            _depth: fidl::encoding::Depth,
207        ) -> fidl::Result<()> {
208            decoder.debug_check_bounds::<Self>(offset);
209            // Verify that padding bytes are zero.
210            fidl::decode!(
211                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
212                D,
213                &mut self.response,
214                decoder,
215                offset + 0,
216                _depth
217            )?;
218            Ok(())
219        }
220    }
221}