fidl_fuchsia_ldsvc_common/
fidl_fuchsia_ldsvc_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
11#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12#[repr(C)]
13pub struct LoaderCloneResponse {
14 pub rv: i32,
15}
16
17impl fidl::Persistable for LoaderCloneResponse {}
18
19#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
20pub struct LoaderConfigRequest {
21 pub config: String,
22}
23
24impl fidl::Persistable for LoaderConfigRequest {}
25
26#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
27#[repr(C)]
28pub struct LoaderConfigResponse {
29 pub rv: i32,
30}
31
32impl fidl::Persistable for LoaderConfigResponse {}
33
34#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
35pub struct LoaderLoadObjectRequest {
36 pub object_name: String,
37}
38
39impl fidl::Persistable for LoaderLoadObjectRequest {}
40
41mod internal {
42 use super::*;
43
44 impl fidl::encoding::ValueTypeMarker for LoaderCloneResponse {
45 type Borrowed<'a> = &'a Self;
46 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
47 value
48 }
49 }
50
51 unsafe impl fidl::encoding::TypeMarker for LoaderCloneResponse {
52 type Owned = Self;
53
54 #[inline(always)]
55 fn inline_align(_context: fidl::encoding::Context) -> usize {
56 4
57 }
58
59 #[inline(always)]
60 fn inline_size(_context: fidl::encoding::Context) -> usize {
61 4
62 }
63 #[inline(always)]
64 fn encode_is_copy() -> bool {
65 true
66 }
67
68 #[inline(always)]
69 fn decode_is_copy() -> bool {
70 true
71 }
72 }
73
74 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LoaderCloneResponse, D>
75 for &LoaderCloneResponse
76 {
77 #[inline]
78 unsafe fn encode(
79 self,
80 encoder: &mut fidl::encoding::Encoder<'_, D>,
81 offset: usize,
82 _depth: fidl::encoding::Depth,
83 ) -> fidl::Result<()> {
84 encoder.debug_check_bounds::<LoaderCloneResponse>(offset);
85 unsafe {
86 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
88 (buf_ptr as *mut LoaderCloneResponse)
89 .write_unaligned((self as *const LoaderCloneResponse).read());
90 }
93 Ok(())
94 }
95 }
96 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
97 fidl::encoding::Encode<LoaderCloneResponse, D> for (T0,)
98 {
99 #[inline]
100 unsafe fn encode(
101 self,
102 encoder: &mut fidl::encoding::Encoder<'_, D>,
103 offset: usize,
104 depth: fidl::encoding::Depth,
105 ) -> fidl::Result<()> {
106 encoder.debug_check_bounds::<LoaderCloneResponse>(offset);
107 self.0.encode(encoder, offset + 0, depth)?;
111 Ok(())
112 }
113 }
114
115 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LoaderCloneResponse {
116 #[inline(always)]
117 fn new_empty() -> Self {
118 Self { rv: fidl::new_empty!(i32, D) }
119 }
120
121 #[inline]
122 unsafe fn decode(
123 &mut self,
124 decoder: &mut fidl::encoding::Decoder<'_, D>,
125 offset: usize,
126 _depth: fidl::encoding::Depth,
127 ) -> fidl::Result<()> {
128 decoder.debug_check_bounds::<Self>(offset);
129 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
130 unsafe {
133 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
134 }
135 Ok(())
136 }
137 }
138
139 impl fidl::encoding::ValueTypeMarker for LoaderConfigRequest {
140 type Borrowed<'a> = &'a Self;
141 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
142 value
143 }
144 }
145
146 unsafe impl fidl::encoding::TypeMarker for LoaderConfigRequest {
147 type Owned = Self;
148
149 #[inline(always)]
150 fn inline_align(_context: fidl::encoding::Context) -> usize {
151 8
152 }
153
154 #[inline(always)]
155 fn inline_size(_context: fidl::encoding::Context) -> usize {
156 16
157 }
158 }
159
160 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LoaderConfigRequest, D>
161 for &LoaderConfigRequest
162 {
163 #[inline]
164 unsafe fn encode(
165 self,
166 encoder: &mut fidl::encoding::Encoder<'_, D>,
167 offset: usize,
168 _depth: fidl::encoding::Depth,
169 ) -> fidl::Result<()> {
170 encoder.debug_check_bounds::<LoaderConfigRequest>(offset);
171 fidl::encoding::Encode::<LoaderConfigRequest, D>::encode(
173 (<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(
174 &self.config,
175 ),),
176 encoder,
177 offset,
178 _depth,
179 )
180 }
181 }
182 unsafe impl<
183 D: fidl::encoding::ResourceDialect,
184 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<1024>, D>,
185 > fidl::encoding::Encode<LoaderConfigRequest, D> for (T0,)
186 {
187 #[inline]
188 unsafe fn encode(
189 self,
190 encoder: &mut fidl::encoding::Encoder<'_, D>,
191 offset: usize,
192 depth: fidl::encoding::Depth,
193 ) -> fidl::Result<()> {
194 encoder.debug_check_bounds::<LoaderConfigRequest>(offset);
195 self.0.encode(encoder, offset + 0, depth)?;
199 Ok(())
200 }
201 }
202
203 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LoaderConfigRequest {
204 #[inline(always)]
205 fn new_empty() -> Self {
206 Self { config: fidl::new_empty!(fidl::encoding::BoundedString<1024>, D) }
207 }
208
209 #[inline]
210 unsafe fn decode(
211 &mut self,
212 decoder: &mut fidl::encoding::Decoder<'_, D>,
213 offset: usize,
214 _depth: fidl::encoding::Depth,
215 ) -> fidl::Result<()> {
216 decoder.debug_check_bounds::<Self>(offset);
217 fidl::decode!(
219 fidl::encoding::BoundedString<1024>,
220 D,
221 &mut self.config,
222 decoder,
223 offset + 0,
224 _depth
225 )?;
226 Ok(())
227 }
228 }
229
230 impl fidl::encoding::ValueTypeMarker for LoaderConfigResponse {
231 type Borrowed<'a> = &'a Self;
232 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
233 value
234 }
235 }
236
237 unsafe impl fidl::encoding::TypeMarker for LoaderConfigResponse {
238 type Owned = Self;
239
240 #[inline(always)]
241 fn inline_align(_context: fidl::encoding::Context) -> usize {
242 4
243 }
244
245 #[inline(always)]
246 fn inline_size(_context: fidl::encoding::Context) -> usize {
247 4
248 }
249 #[inline(always)]
250 fn encode_is_copy() -> bool {
251 true
252 }
253
254 #[inline(always)]
255 fn decode_is_copy() -> bool {
256 true
257 }
258 }
259
260 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LoaderConfigResponse, D>
261 for &LoaderConfigResponse
262 {
263 #[inline]
264 unsafe fn encode(
265 self,
266 encoder: &mut fidl::encoding::Encoder<'_, D>,
267 offset: usize,
268 _depth: fidl::encoding::Depth,
269 ) -> fidl::Result<()> {
270 encoder.debug_check_bounds::<LoaderConfigResponse>(offset);
271 unsafe {
272 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
274 (buf_ptr as *mut LoaderConfigResponse)
275 .write_unaligned((self as *const LoaderConfigResponse).read());
276 }
279 Ok(())
280 }
281 }
282 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
283 fidl::encoding::Encode<LoaderConfigResponse, D> for (T0,)
284 {
285 #[inline]
286 unsafe fn encode(
287 self,
288 encoder: &mut fidl::encoding::Encoder<'_, D>,
289 offset: usize,
290 depth: fidl::encoding::Depth,
291 ) -> fidl::Result<()> {
292 encoder.debug_check_bounds::<LoaderConfigResponse>(offset);
293 self.0.encode(encoder, offset + 0, depth)?;
297 Ok(())
298 }
299 }
300
301 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LoaderConfigResponse {
302 #[inline(always)]
303 fn new_empty() -> Self {
304 Self { rv: fidl::new_empty!(i32, D) }
305 }
306
307 #[inline]
308 unsafe fn decode(
309 &mut self,
310 decoder: &mut fidl::encoding::Decoder<'_, D>,
311 offset: usize,
312 _depth: fidl::encoding::Depth,
313 ) -> fidl::Result<()> {
314 decoder.debug_check_bounds::<Self>(offset);
315 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
316 unsafe {
319 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
320 }
321 Ok(())
322 }
323 }
324
325 impl fidl::encoding::ValueTypeMarker for LoaderLoadObjectRequest {
326 type Borrowed<'a> = &'a Self;
327 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
328 value
329 }
330 }
331
332 unsafe impl fidl::encoding::TypeMarker for LoaderLoadObjectRequest {
333 type Owned = Self;
334
335 #[inline(always)]
336 fn inline_align(_context: fidl::encoding::Context) -> usize {
337 8
338 }
339
340 #[inline(always)]
341 fn inline_size(_context: fidl::encoding::Context) -> usize {
342 16
343 }
344 }
345
346 unsafe impl<D: fidl::encoding::ResourceDialect>
347 fidl::encoding::Encode<LoaderLoadObjectRequest, D> for &LoaderLoadObjectRequest
348 {
349 #[inline]
350 unsafe fn encode(
351 self,
352 encoder: &mut fidl::encoding::Encoder<'_, D>,
353 offset: usize,
354 _depth: fidl::encoding::Depth,
355 ) -> fidl::Result<()> {
356 encoder.debug_check_bounds::<LoaderLoadObjectRequest>(offset);
357 fidl::encoding::Encode::<LoaderLoadObjectRequest, D>::encode(
359 (<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(
360 &self.object_name,
361 ),),
362 encoder,
363 offset,
364 _depth,
365 )
366 }
367 }
368 unsafe impl<
369 D: fidl::encoding::ResourceDialect,
370 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<1024>, D>,
371 > fidl::encoding::Encode<LoaderLoadObjectRequest, D> for (T0,)
372 {
373 #[inline]
374 unsafe fn encode(
375 self,
376 encoder: &mut fidl::encoding::Encoder<'_, D>,
377 offset: usize,
378 depth: fidl::encoding::Depth,
379 ) -> fidl::Result<()> {
380 encoder.debug_check_bounds::<LoaderLoadObjectRequest>(offset);
381 self.0.encode(encoder, offset + 0, depth)?;
385 Ok(())
386 }
387 }
388
389 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
390 for LoaderLoadObjectRequest
391 {
392 #[inline(always)]
393 fn new_empty() -> Self {
394 Self { object_name: fidl::new_empty!(fidl::encoding::BoundedString<1024>, D) }
395 }
396
397 #[inline]
398 unsafe fn decode(
399 &mut self,
400 decoder: &mut fidl::encoding::Decoder<'_, D>,
401 offset: usize,
402 _depth: fidl::encoding::Depth,
403 ) -> fidl::Result<()> {
404 decoder.debug_check_bounds::<Self>(offset);
405 fidl::decode!(
407 fidl::encoding::BoundedString<1024>,
408 D,
409 &mut self.object_name,
410 decoder,
411 offset + 0,
412 _depth
413 )?;
414 Ok(())
415 }
416 }
417}