fidl_fuchsia_samplertestcontroller_common/
fidl_fuchsia_samplertestcontroller_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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
12#[repr(i32)]
13pub enum SamplingError {
14 MultipleSampleCallbacksError = 1,
15}
16
17impl SamplingError {
18 #[inline]
19 pub fn from_primitive(prim: i32) -> Option<Self> {
20 match prim {
21 1 => Some(Self::MultipleSampleCallbacksError),
22 _ => None,
23 }
24 }
25
26 #[inline]
27 pub const fn into_primitive(self) -> i32 {
28 self as i32
29 }
30
31 #[deprecated = "Strict enums should not use `is_unknown`"]
32 #[inline]
33 pub fn is_unknown(&self) -> bool {
34 false
35 }
36}
37
38#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
39#[repr(C)]
40pub struct SamplerTestControllerIncrementIntRequest {
41 pub property_id: u16,
42}
43
44impl fidl::Persistable for SamplerTestControllerIncrementIntRequest {}
45
46#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
47#[repr(C)]
48pub struct SamplerTestControllerSetOptionalRequest {
49 pub value: i64,
50}
51
52impl fidl::Persistable for SamplerTestControllerSetOptionalRequest {}
53
54mod internal {
55 use super::*;
56 unsafe impl fidl::encoding::TypeMarker for SamplingError {
57 type Owned = Self;
58
59 #[inline(always)]
60 fn inline_align(_context: fidl::encoding::Context) -> usize {
61 std::mem::align_of::<i32>()
62 }
63
64 #[inline(always)]
65 fn inline_size(_context: fidl::encoding::Context) -> usize {
66 std::mem::size_of::<i32>()
67 }
68
69 #[inline(always)]
70 fn encode_is_copy() -> bool {
71 true
72 }
73
74 #[inline(always)]
75 fn decode_is_copy() -> bool {
76 false
77 }
78 }
79
80 impl fidl::encoding::ValueTypeMarker for SamplingError {
81 type Borrowed<'a> = Self;
82 #[inline(always)]
83 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
84 *value
85 }
86 }
87
88 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SamplingError {
89 #[inline]
90 unsafe fn encode(
91 self,
92 encoder: &mut fidl::encoding::Encoder<'_, D>,
93 offset: usize,
94 _depth: fidl::encoding::Depth,
95 ) -> fidl::Result<()> {
96 encoder.debug_check_bounds::<Self>(offset);
97 encoder.write_num(self.into_primitive(), offset);
98 Ok(())
99 }
100 }
101
102 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SamplingError {
103 #[inline(always)]
104 fn new_empty() -> Self {
105 Self::MultipleSampleCallbacksError
106 }
107
108 #[inline]
109 unsafe fn decode(
110 &mut self,
111 decoder: &mut fidl::encoding::Decoder<'_, D>,
112 offset: usize,
113 _depth: fidl::encoding::Depth,
114 ) -> fidl::Result<()> {
115 decoder.debug_check_bounds::<Self>(offset);
116 let prim = decoder.read_num::<i32>(offset);
117
118 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
119 Ok(())
120 }
121 }
122
123 impl fidl::encoding::ValueTypeMarker for SamplerTestControllerIncrementIntRequest {
124 type Borrowed<'a> = &'a Self;
125 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
126 value
127 }
128 }
129
130 unsafe impl fidl::encoding::TypeMarker for SamplerTestControllerIncrementIntRequest {
131 type Owned = Self;
132
133 #[inline(always)]
134 fn inline_align(_context: fidl::encoding::Context) -> usize {
135 2
136 }
137
138 #[inline(always)]
139 fn inline_size(_context: fidl::encoding::Context) -> usize {
140 2
141 }
142 #[inline(always)]
143 fn encode_is_copy() -> bool {
144 true
145 }
146
147 #[inline(always)]
148 fn decode_is_copy() -> bool {
149 true
150 }
151 }
152
153 unsafe impl<D: fidl::encoding::ResourceDialect>
154 fidl::encoding::Encode<SamplerTestControllerIncrementIntRequest, D>
155 for &SamplerTestControllerIncrementIntRequest
156 {
157 #[inline]
158 unsafe fn encode(
159 self,
160 encoder: &mut fidl::encoding::Encoder<'_, D>,
161 offset: usize,
162 _depth: fidl::encoding::Depth,
163 ) -> fidl::Result<()> {
164 encoder.debug_check_bounds::<SamplerTestControllerIncrementIntRequest>(offset);
165 unsafe {
166 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
168 (buf_ptr as *mut SamplerTestControllerIncrementIntRequest).write_unaligned(
169 (self as *const SamplerTestControllerIncrementIntRequest).read(),
170 );
171 }
174 Ok(())
175 }
176 }
177 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
178 fidl::encoding::Encode<SamplerTestControllerIncrementIntRequest, D> for (T0,)
179 {
180 #[inline]
181 unsafe fn encode(
182 self,
183 encoder: &mut fidl::encoding::Encoder<'_, D>,
184 offset: usize,
185 depth: fidl::encoding::Depth,
186 ) -> fidl::Result<()> {
187 encoder.debug_check_bounds::<SamplerTestControllerIncrementIntRequest>(offset);
188 self.0.encode(encoder, offset + 0, depth)?;
192 Ok(())
193 }
194 }
195
196 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
197 for SamplerTestControllerIncrementIntRequest
198 {
199 #[inline(always)]
200 fn new_empty() -> Self {
201 Self { property_id: fidl::new_empty!(u16, D) }
202 }
203
204 #[inline]
205 unsafe fn decode(
206 &mut self,
207 decoder: &mut fidl::encoding::Decoder<'_, D>,
208 offset: usize,
209 _depth: fidl::encoding::Depth,
210 ) -> fidl::Result<()> {
211 decoder.debug_check_bounds::<Self>(offset);
212 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
213 unsafe {
216 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
217 }
218 Ok(())
219 }
220 }
221
222 impl fidl::encoding::ValueTypeMarker for SamplerTestControllerSetOptionalRequest {
223 type Borrowed<'a> = &'a Self;
224 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
225 value
226 }
227 }
228
229 unsafe impl fidl::encoding::TypeMarker for SamplerTestControllerSetOptionalRequest {
230 type Owned = Self;
231
232 #[inline(always)]
233 fn inline_align(_context: fidl::encoding::Context) -> usize {
234 8
235 }
236
237 #[inline(always)]
238 fn inline_size(_context: fidl::encoding::Context) -> usize {
239 8
240 }
241 #[inline(always)]
242 fn encode_is_copy() -> bool {
243 true
244 }
245
246 #[inline(always)]
247 fn decode_is_copy() -> bool {
248 true
249 }
250 }
251
252 unsafe impl<D: fidl::encoding::ResourceDialect>
253 fidl::encoding::Encode<SamplerTestControllerSetOptionalRequest, D>
254 for &SamplerTestControllerSetOptionalRequest
255 {
256 #[inline]
257 unsafe fn encode(
258 self,
259 encoder: &mut fidl::encoding::Encoder<'_, D>,
260 offset: usize,
261 _depth: fidl::encoding::Depth,
262 ) -> fidl::Result<()> {
263 encoder.debug_check_bounds::<SamplerTestControllerSetOptionalRequest>(offset);
264 unsafe {
265 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
267 (buf_ptr as *mut SamplerTestControllerSetOptionalRequest).write_unaligned(
268 (self as *const SamplerTestControllerSetOptionalRequest).read(),
269 );
270 }
273 Ok(())
274 }
275 }
276 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
277 fidl::encoding::Encode<SamplerTestControllerSetOptionalRequest, D> for (T0,)
278 {
279 #[inline]
280 unsafe fn encode(
281 self,
282 encoder: &mut fidl::encoding::Encoder<'_, D>,
283 offset: usize,
284 depth: fidl::encoding::Depth,
285 ) -> fidl::Result<()> {
286 encoder.debug_check_bounds::<SamplerTestControllerSetOptionalRequest>(offset);
287 self.0.encode(encoder, offset + 0, depth)?;
291 Ok(())
292 }
293 }
294
295 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
296 for SamplerTestControllerSetOptionalRequest
297 {
298 #[inline(always)]
299 fn new_empty() -> Self {
300 Self { value: fidl::new_empty!(i64, D) }
301 }
302
303 #[inline]
304 unsafe fn decode(
305 &mut self,
306 decoder: &mut fidl::encoding::Decoder<'_, D>,
307 offset: usize,
308 _depth: fidl::encoding::Depth,
309 ) -> fidl::Result<()> {
310 decoder.debug_check_bounds::<Self>(offset);
311 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
312 unsafe {
315 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
316 }
317 Ok(())
318 }
319 }
320}