fidl_fuchsia_intl_test_common/
fidl_fuchsia_intl_test_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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
12#[repr(u64)]
13pub enum MessageIds {
14 StringName = 2873628059656615389,
15 StringName2 = 3826929244932939200,
16 StringName3 = 10195500725288929845,
17}
18
19impl MessageIds {
20 #[inline]
21 pub fn from_primitive(prim: u64) -> Option<Self> {
22 match prim {
23 2873628059656615389 => Some(Self::StringName),
24 3826929244932939200 => Some(Self::StringName2),
25 10195500725288929845 => Some(Self::StringName3),
26 _ => None,
27 }
28 }
29
30 #[inline]
31 pub const fn into_primitive(self) -> u64 {
32 self as u64
33 }
34
35 #[deprecated = "Strict enums should not use `is_unknown`"]
36 #[inline]
37 pub fn is_unknown(&self) -> bool {
38 false
39 }
40}
41
42mod internal {
43 use super::*;
44 unsafe impl fidl::encoding::TypeMarker for MessageIds {
45 type Owned = Self;
46
47 #[inline(always)]
48 fn inline_align(_context: fidl::encoding::Context) -> usize {
49 std::mem::align_of::<u64>()
50 }
51
52 #[inline(always)]
53 fn inline_size(_context: fidl::encoding::Context) -> usize {
54 std::mem::size_of::<u64>()
55 }
56
57 #[inline(always)]
58 fn encode_is_copy() -> bool {
59 true
60 }
61
62 #[inline(always)]
63 fn decode_is_copy() -> bool {
64 false
65 }
66 }
67
68 impl fidl::encoding::ValueTypeMarker for MessageIds {
69 type Borrowed<'a> = Self;
70 #[inline(always)]
71 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
72 *value
73 }
74 }
75
76 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for MessageIds {
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::<Self>(offset);
85 encoder.write_num(self.into_primitive(), offset);
86 Ok(())
87 }
88 }
89
90 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MessageIds {
91 #[inline(always)]
92 fn new_empty() -> Self {
93 Self::StringName
94 }
95
96 #[inline]
97 unsafe fn decode(
98 &mut self,
99 decoder: &mut fidl::encoding::Decoder<'_, D>,
100 offset: usize,
101 _depth: fidl::encoding::Depth,
102 ) -> fidl::Result<()> {
103 decoder.debug_check_bounds::<Self>(offset);
104 let prim = decoder.read_num::<u64>(offset);
105
106 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
107 Ok(())
108 }
109 }
110}