fidl_fuchsia_blackout_test_common/
fidl_fuchsia_blackout_test_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
11pub const MAX_DEVICE_PATH: u64 = 100;
12
13#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub struct ControllerSetupRequest {
15    pub device_label: String,
16    pub device_path: Option<String>,
17    pub seed: u64,
18}
19
20impl fidl::Persistable for ControllerSetupRequest {}
21
22#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23pub struct ControllerTestRequest {
24    pub device_label: String,
25    pub device_path: Option<String>,
26    pub seed: u64,
27    pub duration: u64,
28}
29
30impl fidl::Persistable for ControllerTestRequest {}
31
32#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33pub struct ControllerVerifyRequest {
34    pub device_label: String,
35    pub device_path: Option<String>,
36    pub seed: u64,
37}
38
39impl fidl::Persistable for ControllerVerifyRequest {}
40
41mod internal {
42    use super::*;
43
44    impl fidl::encoding::ValueTypeMarker for ControllerSetupRequest {
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 ControllerSetupRequest {
52        type Owned = Self;
53
54        #[inline(always)]
55        fn inline_align(_context: fidl::encoding::Context) -> usize {
56            8
57        }
58
59        #[inline(always)]
60        fn inline_size(_context: fidl::encoding::Context) -> usize {
61            40
62        }
63    }
64
65    unsafe impl<D: fidl::encoding::ResourceDialect>
66        fidl::encoding::Encode<ControllerSetupRequest, D> for &ControllerSetupRequest
67    {
68        #[inline]
69        unsafe fn encode(
70            self,
71            encoder: &mut fidl::encoding::Encoder<'_, D>,
72            offset: usize,
73            _depth: fidl::encoding::Depth,
74        ) -> fidl::Result<()> {
75            encoder.debug_check_bounds::<ControllerSetupRequest>(offset);
76            // Delegate to tuple encoding.
77            fidl::encoding::Encode::<ControllerSetupRequest, D>::encode(
78                (
79                    <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_label),
80                    <fidl::encoding::Optional<fidl::encoding::BoundedString<100>> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_path),
81                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.seed),
82                ),
83                encoder, offset, _depth
84            )
85        }
86    }
87    unsafe impl<
88            D: fidl::encoding::ResourceDialect,
89            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<100>, D>,
90            T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<100>>, D>,
91            T2: fidl::encoding::Encode<u64, D>,
92        > fidl::encoding::Encode<ControllerSetupRequest, D> for (T0, T1, T2)
93    {
94        #[inline]
95        unsafe fn encode(
96            self,
97            encoder: &mut fidl::encoding::Encoder<'_, D>,
98            offset: usize,
99            depth: fidl::encoding::Depth,
100        ) -> fidl::Result<()> {
101            encoder.debug_check_bounds::<ControllerSetupRequest>(offset);
102            // Zero out padding regions. There's no need to apply masks
103            // because the unmasked parts will be overwritten by fields.
104            // Write the fields.
105            self.0.encode(encoder, offset + 0, depth)?;
106            self.1.encode(encoder, offset + 16, depth)?;
107            self.2.encode(encoder, offset + 32, depth)?;
108            Ok(())
109        }
110    }
111
112    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
113        for ControllerSetupRequest
114    {
115        #[inline(always)]
116        fn new_empty() -> Self {
117            Self {
118                device_label: fidl::new_empty!(fidl::encoding::BoundedString<100>, D),
119                device_path: fidl::new_empty!(
120                    fidl::encoding::Optional<fidl::encoding::BoundedString<100>>,
121                    D
122                ),
123                seed: fidl::new_empty!(u64, D),
124            }
125        }
126
127        #[inline]
128        unsafe fn decode(
129            &mut self,
130            decoder: &mut fidl::encoding::Decoder<'_, D>,
131            offset: usize,
132            _depth: fidl::encoding::Depth,
133        ) -> fidl::Result<()> {
134            decoder.debug_check_bounds::<Self>(offset);
135            // Verify that padding bytes are zero.
136            fidl::decode!(
137                fidl::encoding::BoundedString<100>,
138                D,
139                &mut self.device_label,
140                decoder,
141                offset + 0,
142                _depth
143            )?;
144            fidl::decode!(
145                fidl::encoding::Optional<fidl::encoding::BoundedString<100>>,
146                D,
147                &mut self.device_path,
148                decoder,
149                offset + 16,
150                _depth
151            )?;
152            fidl::decode!(u64, D, &mut self.seed, decoder, offset + 32, _depth)?;
153            Ok(())
154        }
155    }
156
157    impl fidl::encoding::ValueTypeMarker for ControllerTestRequest {
158        type Borrowed<'a> = &'a Self;
159        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
160            value
161        }
162    }
163
164    unsafe impl fidl::encoding::TypeMarker for ControllerTestRequest {
165        type Owned = Self;
166
167        #[inline(always)]
168        fn inline_align(_context: fidl::encoding::Context) -> usize {
169            8
170        }
171
172        #[inline(always)]
173        fn inline_size(_context: fidl::encoding::Context) -> usize {
174            48
175        }
176    }
177
178    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ControllerTestRequest, D>
179        for &ControllerTestRequest
180    {
181        #[inline]
182        unsafe fn encode(
183            self,
184            encoder: &mut fidl::encoding::Encoder<'_, D>,
185            offset: usize,
186            _depth: fidl::encoding::Depth,
187        ) -> fidl::Result<()> {
188            encoder.debug_check_bounds::<ControllerTestRequest>(offset);
189            // Delegate to tuple encoding.
190            fidl::encoding::Encode::<ControllerTestRequest, D>::encode(
191                (
192                    <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_label),
193                    <fidl::encoding::Optional<fidl::encoding::BoundedString<100>> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_path),
194                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.seed),
195                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.duration),
196                ),
197                encoder, offset, _depth
198            )
199        }
200    }
201    unsafe impl<
202            D: fidl::encoding::ResourceDialect,
203            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<100>, D>,
204            T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<100>>, D>,
205            T2: fidl::encoding::Encode<u64, D>,
206            T3: fidl::encoding::Encode<u64, D>,
207        > fidl::encoding::Encode<ControllerTestRequest, D> for (T0, T1, T2, T3)
208    {
209        #[inline]
210        unsafe fn encode(
211            self,
212            encoder: &mut fidl::encoding::Encoder<'_, D>,
213            offset: usize,
214            depth: fidl::encoding::Depth,
215        ) -> fidl::Result<()> {
216            encoder.debug_check_bounds::<ControllerTestRequest>(offset);
217            // Zero out padding regions. There's no need to apply masks
218            // because the unmasked parts will be overwritten by fields.
219            // Write the fields.
220            self.0.encode(encoder, offset + 0, depth)?;
221            self.1.encode(encoder, offset + 16, depth)?;
222            self.2.encode(encoder, offset + 32, depth)?;
223            self.3.encode(encoder, offset + 40, depth)?;
224            Ok(())
225        }
226    }
227
228    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ControllerTestRequest {
229        #[inline(always)]
230        fn new_empty() -> Self {
231            Self {
232                device_label: fidl::new_empty!(fidl::encoding::BoundedString<100>, D),
233                device_path: fidl::new_empty!(
234                    fidl::encoding::Optional<fidl::encoding::BoundedString<100>>,
235                    D
236                ),
237                seed: fidl::new_empty!(u64, D),
238                duration: fidl::new_empty!(u64, D),
239            }
240        }
241
242        #[inline]
243        unsafe fn decode(
244            &mut self,
245            decoder: &mut fidl::encoding::Decoder<'_, D>,
246            offset: usize,
247            _depth: fidl::encoding::Depth,
248        ) -> fidl::Result<()> {
249            decoder.debug_check_bounds::<Self>(offset);
250            // Verify that padding bytes are zero.
251            fidl::decode!(
252                fidl::encoding::BoundedString<100>,
253                D,
254                &mut self.device_label,
255                decoder,
256                offset + 0,
257                _depth
258            )?;
259            fidl::decode!(
260                fidl::encoding::Optional<fidl::encoding::BoundedString<100>>,
261                D,
262                &mut self.device_path,
263                decoder,
264                offset + 16,
265                _depth
266            )?;
267            fidl::decode!(u64, D, &mut self.seed, decoder, offset + 32, _depth)?;
268            fidl::decode!(u64, D, &mut self.duration, decoder, offset + 40, _depth)?;
269            Ok(())
270        }
271    }
272
273    impl fidl::encoding::ValueTypeMarker for ControllerVerifyRequest {
274        type Borrowed<'a> = &'a Self;
275        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
276            value
277        }
278    }
279
280    unsafe impl fidl::encoding::TypeMarker for ControllerVerifyRequest {
281        type Owned = Self;
282
283        #[inline(always)]
284        fn inline_align(_context: fidl::encoding::Context) -> usize {
285            8
286        }
287
288        #[inline(always)]
289        fn inline_size(_context: fidl::encoding::Context) -> usize {
290            40
291        }
292    }
293
294    unsafe impl<D: fidl::encoding::ResourceDialect>
295        fidl::encoding::Encode<ControllerVerifyRequest, D> for &ControllerVerifyRequest
296    {
297        #[inline]
298        unsafe fn encode(
299            self,
300            encoder: &mut fidl::encoding::Encoder<'_, D>,
301            offset: usize,
302            _depth: fidl::encoding::Depth,
303        ) -> fidl::Result<()> {
304            encoder.debug_check_bounds::<ControllerVerifyRequest>(offset);
305            // Delegate to tuple encoding.
306            fidl::encoding::Encode::<ControllerVerifyRequest, D>::encode(
307                (
308                    <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_label),
309                    <fidl::encoding::Optional<fidl::encoding::BoundedString<100>> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_path),
310                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.seed),
311                ),
312                encoder, offset, _depth
313            )
314        }
315    }
316    unsafe impl<
317            D: fidl::encoding::ResourceDialect,
318            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<100>, D>,
319            T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<100>>, D>,
320            T2: fidl::encoding::Encode<u64, D>,
321        > fidl::encoding::Encode<ControllerVerifyRequest, D> for (T0, T1, T2)
322    {
323        #[inline]
324        unsafe fn encode(
325            self,
326            encoder: &mut fidl::encoding::Encoder<'_, D>,
327            offset: usize,
328            depth: fidl::encoding::Depth,
329        ) -> fidl::Result<()> {
330            encoder.debug_check_bounds::<ControllerVerifyRequest>(offset);
331            // Zero out padding regions. There's no need to apply masks
332            // because the unmasked parts will be overwritten by fields.
333            // Write the fields.
334            self.0.encode(encoder, offset + 0, depth)?;
335            self.1.encode(encoder, offset + 16, depth)?;
336            self.2.encode(encoder, offset + 32, depth)?;
337            Ok(())
338        }
339    }
340
341    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
342        for ControllerVerifyRequest
343    {
344        #[inline(always)]
345        fn new_empty() -> Self {
346            Self {
347                device_label: fidl::new_empty!(fidl::encoding::BoundedString<100>, D),
348                device_path: fidl::new_empty!(
349                    fidl::encoding::Optional<fidl::encoding::BoundedString<100>>,
350                    D
351                ),
352                seed: fidl::new_empty!(u64, D),
353            }
354        }
355
356        #[inline]
357        unsafe fn decode(
358            &mut self,
359            decoder: &mut fidl::encoding::Decoder<'_, D>,
360            offset: usize,
361            _depth: fidl::encoding::Depth,
362        ) -> fidl::Result<()> {
363            decoder.debug_check_bounds::<Self>(offset);
364            // Verify that padding bytes are zero.
365            fidl::decode!(
366                fidl::encoding::BoundedString<100>,
367                D,
368                &mut self.device_label,
369                decoder,
370                offset + 0,
371                _depth
372            )?;
373            fidl::decode!(
374                fidl::encoding::Optional<fidl::encoding::BoundedString<100>>,
375                D,
376                &mut self.device_path,
377                decoder,
378                offset + 16,
379                _depth
380            )?;
381            fidl::decode!(u64, D, &mut self.seed, decoder, offset + 32, _depth)?;
382            Ok(())
383        }
384    }
385}