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