hyperlight_common/flatbuffers/hyperlight/generated/
error_code_generated.rs1extern 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_ERROR_CODE: u64 = 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_ERROR_CODE: u64 = 17;
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_ERROR_CODE: [ErrorCode; 17] = [
29 ErrorCode::NoError,
30 ErrorCode::UnsupportedParameterType,
31 ErrorCode::GuestFunctionNameNotProvided,
32 ErrorCode::GuestFunctionNotFound,
33 ErrorCode::GuestFunctionIncorrecNoOfParameters,
34 ErrorCode::GispatchFunctionPointerNotSet,
35 ErrorCode::OutbError,
36 ErrorCode::UnknownError,
37 ErrorCode::StackOverflow,
38 ErrorCode::GsCheckFailed,
39 ErrorCode::TooManyGuestFunctions,
40 ErrorCode::FailureInDlmalloc,
41 ErrorCode::MallocFailed,
42 ErrorCode::GuestFunctionParameterTypeMismatch,
43 ErrorCode::GuestError,
44 ErrorCode::ArrayLengthParamIsMissing,
45 ErrorCode::HostError,
46];
47
48#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
49#[repr(transparent)]
50pub struct ErrorCode(pub u64);
51#[allow(non_upper_case_globals)]
52impl ErrorCode {
53 pub const NoError: Self = Self(0);
54 pub const UnsupportedParameterType: Self = Self(2);
55 pub const GuestFunctionNameNotProvided: Self = Self(3);
56 pub const GuestFunctionNotFound: Self = Self(4);
57 pub const GuestFunctionIncorrecNoOfParameters: Self = Self(5);
58 pub const GispatchFunctionPointerNotSet: Self = Self(6);
59 pub const OutbError: Self = Self(7);
60 pub const UnknownError: Self = Self(8);
61 pub const StackOverflow: Self = Self(9);
62 pub const GsCheckFailed: Self = Self(10);
63 pub const TooManyGuestFunctions: Self = Self(11);
64 pub const FailureInDlmalloc: Self = Self(12);
65 pub const MallocFailed: Self = Self(13);
66 pub const GuestFunctionParameterTypeMismatch: Self = Self(14);
67 pub const GuestError: Self = Self(15);
68 pub const ArrayLengthParamIsMissing: Self = Self(16);
69 pub const HostError: Self = Self(17);
70
71 pub const ENUM_MIN: u64 = 0;
72 pub const ENUM_MAX: u64 = 17;
73 pub const ENUM_VALUES: &'static [Self] = &[
74 Self::NoError,
75 Self::UnsupportedParameterType,
76 Self::GuestFunctionNameNotProvided,
77 Self::GuestFunctionNotFound,
78 Self::GuestFunctionIncorrecNoOfParameters,
79 Self::GispatchFunctionPointerNotSet,
80 Self::OutbError,
81 Self::UnknownError,
82 Self::StackOverflow,
83 Self::GsCheckFailed,
84 Self::TooManyGuestFunctions,
85 Self::FailureInDlmalloc,
86 Self::MallocFailed,
87 Self::GuestFunctionParameterTypeMismatch,
88 Self::GuestError,
89 Self::ArrayLengthParamIsMissing,
90 Self::HostError,
91 ];
92 pub fn variant_name(self) -> Option<&'static str> {
94 match self {
95 Self::NoError => Some("NoError"),
96 Self::UnsupportedParameterType => Some("UnsupportedParameterType"),
97 Self::GuestFunctionNameNotProvided => Some("GuestFunctionNameNotProvided"),
98 Self::GuestFunctionNotFound => Some("GuestFunctionNotFound"),
99 Self::GuestFunctionIncorrecNoOfParameters => {
100 Some("GuestFunctionIncorrecNoOfParameters")
101 }
102 Self::GispatchFunctionPointerNotSet => Some("GispatchFunctionPointerNotSet"),
103 Self::OutbError => Some("OutbError"),
104 Self::UnknownError => Some("UnknownError"),
105 Self::StackOverflow => Some("StackOverflow"),
106 Self::GsCheckFailed => Some("GsCheckFailed"),
107 Self::TooManyGuestFunctions => Some("TooManyGuestFunctions"),
108 Self::FailureInDlmalloc => Some("FailureInDlmalloc"),
109 Self::MallocFailed => Some("MallocFailed"),
110 Self::GuestFunctionParameterTypeMismatch => Some("GuestFunctionParameterTypeMismatch"),
111 Self::GuestError => Some("GuestError"),
112 Self::ArrayLengthParamIsMissing => Some("ArrayLengthParamIsMissing"),
113 Self::HostError => Some("HostError"),
114 _ => None,
115 }
116 }
117}
118impl core::fmt::Debug for ErrorCode {
119 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
120 if let Some(name) = self.variant_name() {
121 f.write_str(name)
122 } else {
123 f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
124 }
125 }
126}
127impl<'a> flatbuffers::Follow<'a> for ErrorCode {
128 type Inner = Self;
129 #[inline]
130 unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
131 let b = unsafe { flatbuffers::read_scalar_at::<u64>(buf, loc) };
132 Self(b)
133 }
134}
135
136impl flatbuffers::Push for ErrorCode {
137 type Output = ErrorCode;
138 #[inline]
139 unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
140 unsafe {
141 flatbuffers::emplace_scalar::<u64>(dst, self.0);
142 }
143 }
144}
145
146impl flatbuffers::EndianScalar for ErrorCode {
147 type Scalar = u64;
148 #[inline]
149 fn to_little_endian(self) -> u64 {
150 self.0.to_le()
151 }
152 #[inline]
153 #[allow(clippy::wrong_self_convention)]
154 fn from_little_endian(v: u64) -> Self {
155 let b = u64::from_le(v);
156 Self(b)
157 }
158}
159
160impl<'a> flatbuffers::Verifiable for ErrorCode {
161 #[inline]
162 fn run_verifier(
163 v: &mut flatbuffers::Verifier,
164 pos: usize,
165 ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
166 use self::flatbuffers::Verifiable;
167 u64::run_verifier(v, pos)
168 }
169}
170
171impl flatbuffers::SimpleToVerifyInSlice for ErrorCode {}