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