fidl_test_trippoint__common/
fidl_test_trippoint__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 ControlSetTemperatureCelsiusRequest {
13    pub status: i32,
14    pub temp: f32,
15}
16
17impl fidl::Persistable for ControlSetTemperatureCelsiusRequest {}
18
19pub mod control_ordinals {
20    pub const SET_TEMPERATURE_CELSIUS: u64 = 0x1f4a3a4f2e8e34bc;
21}
22
23mod internal {
24    use super::*;
25
26    impl fidl::encoding::ValueTypeMarker for ControlSetTemperatureCelsiusRequest {
27        type Borrowed<'a> = &'a Self;
28        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
29            value
30        }
31    }
32
33    unsafe impl fidl::encoding::TypeMarker for ControlSetTemperatureCelsiusRequest {
34        type Owned = Self;
35
36        #[inline(always)]
37        fn inline_align(_context: fidl::encoding::Context) -> usize {
38            4
39        }
40
41        #[inline(always)]
42        fn inline_size(_context: fidl::encoding::Context) -> usize {
43            8
44        }
45    }
46
47    unsafe impl<D: fidl::encoding::ResourceDialect>
48        fidl::encoding::Encode<ControlSetTemperatureCelsiusRequest, D>
49        for &ControlSetTemperatureCelsiusRequest
50    {
51        #[inline]
52        unsafe fn encode(
53            self,
54            encoder: &mut fidl::encoding::Encoder<'_, D>,
55            offset: usize,
56            _depth: fidl::encoding::Depth,
57        ) -> fidl::Result<()> {
58            encoder.debug_check_bounds::<ControlSetTemperatureCelsiusRequest>(offset);
59            // Delegate to tuple encoding.
60            fidl::encoding::Encode::<ControlSetTemperatureCelsiusRequest, D>::encode(
61                (
62                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
63                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.temp),
64                ),
65                encoder,
66                offset,
67                _depth,
68            )
69        }
70    }
71    unsafe impl<
72            D: fidl::encoding::ResourceDialect,
73            T0: fidl::encoding::Encode<i32, D>,
74            T1: fidl::encoding::Encode<f32, D>,
75        > fidl::encoding::Encode<ControlSetTemperatureCelsiusRequest, D> for (T0, T1)
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::<ControlSetTemperatureCelsiusRequest>(offset);
85            // Zero out padding regions. There's no need to apply masks
86            // because the unmasked parts will be overwritten by fields.
87            // Write the fields.
88            self.0.encode(encoder, offset + 0, depth)?;
89            self.1.encode(encoder, offset + 4, depth)?;
90            Ok(())
91        }
92    }
93
94    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
95        for ControlSetTemperatureCelsiusRequest
96    {
97        #[inline(always)]
98        fn new_empty() -> Self {
99            Self { status: fidl::new_empty!(i32, D), temp: 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!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
112            fidl::decode!(f32, D, &mut self.temp, decoder, offset + 4, _depth)?;
113            Ok(())
114        }
115    }
116}