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