fidl_fuchsia_powermanager_driver_temperaturecontrol__common/
fidl_fuchsia_powermanager_driver_temperaturecontrol__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
11#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
12pub struct DeviceSetTemperatureCelsiusRequest {
13    pub temperature: f32,
14}
15
16impl fidl::Persistable for DeviceSetTemperatureCelsiusRequest {}
17
18#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
19#[repr(C)]
20pub struct DeviceSetTemperatureCelsiusResponse {
21    pub status: i32,
22}
23
24impl fidl::Persistable for DeviceSetTemperatureCelsiusResponse {}
25
26pub mod device_ordinals {
27    pub const SET_TEMPERATURE_CELSIUS: u64 = 0x15b847f05a354b95;
28}
29
30mod internal {
31    use super::*;
32
33    impl fidl::encoding::ValueTypeMarker for DeviceSetTemperatureCelsiusRequest {
34        type Borrowed<'a> = &'a Self;
35        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
36            value
37        }
38    }
39
40    unsafe impl fidl::encoding::TypeMarker for DeviceSetTemperatureCelsiusRequest {
41        type Owned = Self;
42
43        #[inline(always)]
44        fn inline_align(_context: fidl::encoding::Context) -> usize {
45            4
46        }
47
48        #[inline(always)]
49        fn inline_size(_context: fidl::encoding::Context) -> usize {
50            4
51        }
52    }
53
54    unsafe impl<D: fidl::encoding::ResourceDialect>
55        fidl::encoding::Encode<DeviceSetTemperatureCelsiusRequest, D>
56        for &DeviceSetTemperatureCelsiusRequest
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::<DeviceSetTemperatureCelsiusRequest>(offset);
66            // Delegate to tuple encoding.
67            fidl::encoding::Encode::<DeviceSetTemperatureCelsiusRequest, D>::encode(
68                (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.temperature),),
69                encoder,
70                offset,
71                _depth,
72            )
73        }
74    }
75    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
76        fidl::encoding::Encode<DeviceSetTemperatureCelsiusRequest, D> for (T0,)
77    {
78        #[inline]
79        unsafe fn encode(
80            self,
81            encoder: &mut fidl::encoding::Encoder<'_, D>,
82            offset: usize,
83            depth: fidl::encoding::Depth,
84        ) -> fidl::Result<()> {
85            encoder.debug_check_bounds::<DeviceSetTemperatureCelsiusRequest>(offset);
86            // Zero out padding regions. There's no need to apply masks
87            // because the unmasked parts will be overwritten by fields.
88            // Write the fields.
89            self.0.encode(encoder, offset + 0, depth)?;
90            Ok(())
91        }
92    }
93
94    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
95        for DeviceSetTemperatureCelsiusRequest
96    {
97        #[inline(always)]
98        fn new_empty() -> Self {
99            Self { temperature: fidl::new_empty!(f32, D) }
100        }
101
102        #[inline]
103        unsafe fn decode(
104            &mut self,
105            decoder: &mut fidl::encoding::Decoder<'_, D>,
106            offset: usize,
107            _depth: fidl::encoding::Depth,
108        ) -> fidl::Result<()> {
109            decoder.debug_check_bounds::<Self>(offset);
110            // Verify that padding bytes are zero.
111            fidl::decode!(f32, D, &mut self.temperature, decoder, offset + 0, _depth)?;
112            Ok(())
113        }
114    }
115
116    impl fidl::encoding::ValueTypeMarker for DeviceSetTemperatureCelsiusResponse {
117        type Borrowed<'a> = &'a Self;
118        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
119            value
120        }
121    }
122
123    unsafe impl fidl::encoding::TypeMarker for DeviceSetTemperatureCelsiusResponse {
124        type Owned = Self;
125
126        #[inline(always)]
127        fn inline_align(_context: fidl::encoding::Context) -> usize {
128            4
129        }
130
131        #[inline(always)]
132        fn inline_size(_context: fidl::encoding::Context) -> usize {
133            4
134        }
135        #[inline(always)]
136        fn encode_is_copy() -> bool {
137            true
138        }
139
140        #[inline(always)]
141        fn decode_is_copy() -> bool {
142            true
143        }
144    }
145
146    unsafe impl<D: fidl::encoding::ResourceDialect>
147        fidl::encoding::Encode<DeviceSetTemperatureCelsiusResponse, D>
148        for &DeviceSetTemperatureCelsiusResponse
149    {
150        #[inline]
151        unsafe fn encode(
152            self,
153            encoder: &mut fidl::encoding::Encoder<'_, D>,
154            offset: usize,
155            _depth: fidl::encoding::Depth,
156        ) -> fidl::Result<()> {
157            encoder.debug_check_bounds::<DeviceSetTemperatureCelsiusResponse>(offset);
158            unsafe {
159                // Copy the object into the buffer.
160                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
161                (buf_ptr as *mut DeviceSetTemperatureCelsiusResponse)
162                    .write_unaligned((self as *const DeviceSetTemperatureCelsiusResponse).read());
163                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
164                // done second because the memcpy will write garbage to these bytes.
165            }
166            Ok(())
167        }
168    }
169    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
170        fidl::encoding::Encode<DeviceSetTemperatureCelsiusResponse, D> for (T0,)
171    {
172        #[inline]
173        unsafe fn encode(
174            self,
175            encoder: &mut fidl::encoding::Encoder<'_, D>,
176            offset: usize,
177            depth: fidl::encoding::Depth,
178        ) -> fidl::Result<()> {
179            encoder.debug_check_bounds::<DeviceSetTemperatureCelsiusResponse>(offset);
180            // Zero out padding regions. There's no need to apply masks
181            // because the unmasked parts will be overwritten by fields.
182            // Write the fields.
183            self.0.encode(encoder, offset + 0, depth)?;
184            Ok(())
185        }
186    }
187
188    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
189        for DeviceSetTemperatureCelsiusResponse
190    {
191        #[inline(always)]
192        fn new_empty() -> Self {
193            Self { status: fidl::new_empty!(i32, D) }
194        }
195
196        #[inline]
197        unsafe fn decode(
198            &mut self,
199            decoder: &mut fidl::encoding::Decoder<'_, D>,
200            offset: usize,
201            _depth: fidl::encoding::Depth,
202        ) -> fidl::Result<()> {
203            decoder.debug_check_bounds::<Self>(offset);
204            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
205            // Verify that padding bytes are zero.
206            // Copy from the buffer into the object.
207            unsafe {
208                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
209            }
210            Ok(())
211        }
212    }
213}