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 BoostError {
14    NotSupported = 0,
15    Internal = 1,
16}
17
18impl BoostError {
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
34pub mod boost_ordinals {
35    pub const BOOST: u64 = 0x814fabf86f2b1a3;
36}
37
38mod internal {
39    use super::*;
40    unsafe impl fidl::encoding::TypeMarker for BoostError {
41        type Owned = Self;
42
43        #[inline(always)]
44        fn inline_align(_context: fidl::encoding::Context) -> usize {
45            std::mem::align_of::<u32>()
46        }
47
48        #[inline(always)]
49        fn inline_size(_context: fidl::encoding::Context) -> usize {
50            std::mem::size_of::<u32>()
51        }
52
53        #[inline(always)]
54        fn encode_is_copy() -> bool {
55            true
56        }
57
58        #[inline(always)]
59        fn decode_is_copy() -> bool {
60            false
61        }
62    }
63
64    impl fidl::encoding::ValueTypeMarker for BoostError {
65        type Borrowed<'a> = Self;
66        #[inline(always)]
67        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
68            *value
69        }
70    }
71
72    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for BoostError {
73        #[inline]
74        unsafe fn encode(
75            self,
76            encoder: &mut fidl::encoding::Encoder<'_, D>,
77            offset: usize,
78            _depth: fidl::encoding::Depth,
79        ) -> fidl::Result<()> {
80            encoder.debug_check_bounds::<Self>(offset);
81            encoder.write_num(self.into_primitive(), offset);
82            Ok(())
83        }
84    }
85
86    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BoostError {
87        #[inline(always)]
88        fn new_empty() -> Self {
89            Self::NotSupported
90        }
91
92        #[inline]
93        unsafe fn decode(
94            &mut self,
95            decoder: &mut fidl::encoding::Decoder<'_, D>,
96            offset: usize,
97            _depth: fidl::encoding::Depth,
98        ) -> fidl::Result<()> {
99            decoder.debug_check_bounds::<Self>(offset);
100            let prim = decoder.read_num::<u32>(offset);
101
102            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
103            Ok(())
104        }
105    }
106}