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