fidl_fuchsia_power_cpu_manager__common/
fidl_fuchsia_power_cpu_manager__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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
12#[repr(u32)]
13pub enum SetBoostError {
14    NotSupported = 0,
15    Internal = 1,
16}
17
18impl SetBoostError {
19    #[inline]
20    pub fn from_primitive(prim: u32) -> Option<Self> {
21        match prim {
22            0 => Some(Self::NotSupported),
23            1 => Some(Self::Internal),
24            _ => None,
25        }
26    }
27
28    #[inline]
29    pub const fn into_primitive(self) -> u32 {
30        self as u32
31    }
32}
33
34#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
35pub struct BoostSetBoostRequest {
36    pub enable: bool,
37}
38
39impl fidl::Persistable for BoostSetBoostRequest {}
40
41pub mod boost_ordinals {
42    pub const SET_BOOST: u64 = 0x22c73b207ffdf433;
43}
44
45mod internal {
46    use super::*;
47    unsafe impl fidl::encoding::TypeMarker for SetBoostError {
48        type Owned = Self;
49
50        #[inline(always)]
51        fn inline_align(_context: fidl::encoding::Context) -> usize {
52            std::mem::align_of::<u32>()
53        }
54
55        #[inline(always)]
56        fn inline_size(_context: fidl::encoding::Context) -> usize {
57            std::mem::size_of::<u32>()
58        }
59
60        #[inline(always)]
61        fn encode_is_copy() -> bool {
62            true
63        }
64
65        #[inline(always)]
66        fn decode_is_copy() -> bool {
67            false
68        }
69    }
70
71    impl fidl::encoding::ValueTypeMarker for SetBoostError {
72        type Borrowed<'a> = Self;
73        #[inline(always)]
74        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
75            *value
76        }
77    }
78
79    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SetBoostError {
80        #[inline]
81        unsafe fn encode(
82            self,
83            encoder: &mut fidl::encoding::Encoder<'_, D>,
84            offset: usize,
85            _depth: fidl::encoding::Depth,
86        ) -> fidl::Result<()> {
87            encoder.debug_check_bounds::<Self>(offset);
88            encoder.write_num(self.into_primitive(), offset);
89            Ok(())
90        }
91    }
92
93    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SetBoostError {
94        #[inline(always)]
95        fn new_empty() -> Self {
96            Self::NotSupported
97        }
98
99        #[inline]
100        unsafe fn decode(
101            &mut self,
102            decoder: &mut fidl::encoding::Decoder<'_, D>,
103            offset: usize,
104            _depth: fidl::encoding::Depth,
105        ) -> fidl::Result<()> {
106            decoder.debug_check_bounds::<Self>(offset);
107            let prim = decoder.read_num::<u32>(offset);
108
109            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
110            Ok(())
111        }
112    }
113
114    impl fidl::encoding::ValueTypeMarker for BoostSetBoostRequest {
115        type Borrowed<'a> = &'a Self;
116        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
117            value
118        }
119    }
120
121    unsafe impl fidl::encoding::TypeMarker for BoostSetBoostRequest {
122        type Owned = Self;
123
124        #[inline(always)]
125        fn inline_align(_context: fidl::encoding::Context) -> usize {
126            1
127        }
128
129        #[inline(always)]
130        fn inline_size(_context: fidl::encoding::Context) -> usize {
131            1
132        }
133    }
134
135    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BoostSetBoostRequest, D>
136        for &BoostSetBoostRequest
137    {
138        #[inline]
139        unsafe fn encode(
140            self,
141            encoder: &mut fidl::encoding::Encoder<'_, D>,
142            offset: usize,
143            _depth: fidl::encoding::Depth,
144        ) -> fidl::Result<()> {
145            encoder.debug_check_bounds::<BoostSetBoostRequest>(offset);
146            // Delegate to tuple encoding.
147            fidl::encoding::Encode::<BoostSetBoostRequest, D>::encode(
148                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable),),
149                encoder,
150                offset,
151                _depth,
152            )
153        }
154    }
155    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
156        fidl::encoding::Encode<BoostSetBoostRequest, D> for (T0,)
157    {
158        #[inline]
159        unsafe fn encode(
160            self,
161            encoder: &mut fidl::encoding::Encoder<'_, D>,
162            offset: usize,
163            depth: fidl::encoding::Depth,
164        ) -> fidl::Result<()> {
165            encoder.debug_check_bounds::<BoostSetBoostRequest>(offset);
166            // Zero out padding regions. There's no need to apply masks
167            // because the unmasked parts will be overwritten by fields.
168            // Write the fields.
169            self.0.encode(encoder, offset + 0, depth)?;
170            Ok(())
171        }
172    }
173
174    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BoostSetBoostRequest {
175        #[inline(always)]
176        fn new_empty() -> Self {
177            Self { enable: fidl::new_empty!(bool, D) }
178        }
179
180        #[inline]
181        unsafe fn decode(
182            &mut self,
183            decoder: &mut fidl::encoding::Decoder<'_, D>,
184            offset: usize,
185            _depth: fidl::encoding::Depth,
186        ) -> fidl::Result<()> {
187            decoder.debug_check_bounds::<Self>(offset);
188            // Verify that padding bytes are zero.
189            fidl::decode!(bool, D, &mut self.enable, decoder, offset + 0, _depth)?;
190            Ok(())
191        }
192    }
193}