Skip to main content

hyperlight_common/flatbuffers/hyperlight/generated/
function_call_type_generated.rs

1// automatically generated by the FlatBuffers compiler, do not modify
2// @generated
3extern crate alloc;
4extern crate flatbuffers;
5use alloc::boxed::Box;
6use alloc::string::{String, ToString};
7use alloc::vec::Vec;
8use core::cmp::Ordering;
9use core::mem;
10
11use self::flatbuffers::{EndianScalar, Follow};
12use super::*;
13#[deprecated(
14    since = "2.0.0",
15    note = "Use associated constants instead. This will no longer be generated in 2021."
16)]
17pub const ENUM_MIN_FUNCTION_CALL_TYPE: u8 = 0;
18#[deprecated(
19    since = "2.0.0",
20    note = "Use associated constants instead. This will no longer be generated in 2021."
21)]
22pub const ENUM_MAX_FUNCTION_CALL_TYPE: u8 = 2;
23#[deprecated(
24    since = "2.0.0",
25    note = "Use associated constants instead. This will no longer be generated in 2021."
26)]
27#[allow(non_camel_case_types)]
28pub const ENUM_VALUES_FUNCTION_CALL_TYPE: [FunctionCallType; 3] = [
29    FunctionCallType::none,
30    FunctionCallType::guest,
31    FunctionCallType::host,
32];
33
34#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
35#[repr(transparent)]
36pub struct FunctionCallType(pub u8);
37#[allow(non_upper_case_globals)]
38impl FunctionCallType {
39    pub const none: Self = Self(0);
40    pub const guest: Self = Self(1);
41    pub const host: Self = Self(2);
42
43    pub const ENUM_MIN: u8 = 0;
44    pub const ENUM_MAX: u8 = 2;
45    pub const ENUM_VALUES: &'static [Self] = &[Self::none, Self::guest, Self::host];
46    /// Returns the variant's name or "" if unknown.
47    pub fn variant_name(self) -> Option<&'static str> {
48        match self {
49            Self::none => Some("none"),
50            Self::guest => Some("guest"),
51            Self::host => Some("host"),
52            _ => None,
53        }
54    }
55}
56impl core::fmt::Debug for FunctionCallType {
57    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
58        if let Some(name) = self.variant_name() {
59            f.write_str(name)
60        } else {
61            f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
62        }
63    }
64}
65impl<'a> flatbuffers::Follow<'a> for FunctionCallType {
66    type Inner = Self;
67    #[inline]
68    unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
69        let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) };
70        Self(b)
71    }
72}
73
74impl flatbuffers::Push for FunctionCallType {
75    type Output = FunctionCallType;
76    #[inline]
77    unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
78        unsafe {
79            flatbuffers::emplace_scalar::<u8>(dst, self.0);
80        }
81    }
82}
83
84impl flatbuffers::EndianScalar for FunctionCallType {
85    type Scalar = u8;
86    #[inline]
87    fn to_little_endian(self) -> u8 {
88        self.0.to_le()
89    }
90    #[inline]
91    #[allow(clippy::wrong_self_convention)]
92    fn from_little_endian(v: u8) -> Self {
93        let b = u8::from_le(v);
94        Self(b)
95    }
96}
97
98impl<'a> flatbuffers::Verifiable for FunctionCallType {
99    #[inline]
100    fn run_verifier(
101        v: &mut flatbuffers::Verifier,
102        pos: usize,
103    ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
104        use self::flatbuffers::Verifiable;
105        u8::run_verifier(v, pos)
106    }
107}
108
109impl flatbuffers::SimpleToVerifyInSlice for FunctionCallType {}