thruput_xdr/
exec_result.rs1#![allow(non_camel_case_types)]
7#![allow(non_snake_case)]
8#![allow(non_upper_case_globals)]
9#![allow(unused_imports)]
10#![allow(dead_code)]
11#![allow(unused_variables)]
12#![allow(clippy::unnecessary_cast)]
13
14use crate::*;
15use core::option::Option;
16use core::ops::{Deref, DerefMut};
17
18#[cfg(feature = "std")]
19use std::io::{Read, Write};
20#[cfg(feature = "xdrs")]
21use xdrs::*;
22
23
24#[cfg(feature = "serde")]
25use ::serde::{{Serialize, Deserialize}};
26
27
28#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
29#[cfg_attr(feature = "serde", serde(transparent))]
30#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
31#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
32#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
33#[derive(Copy)]
34#[repr(transparent)]
35pub struct ExecResult(pub i32);
36
37impl ExecResult {
38 pub const ExecResultOK: Self = Self(0);
39
40 pub const ExecResultTxDeterministicError: Self = Self(1);
45
46 pub const ExecResultTxRootFrameReverted: Self = Self(2);
50
51 pub const ExecResultTxNonDeterministicError: Self = Self(3);
56
57 pub const ExecResultFailedGasSponsorship: Self = Self(100);
60
61 pub const ExecResultTxValidationFailure: Self = Self(200);
66
67 pub const ExecResultMalformedTransaction: Self = Self(201);
74
75 pub const ExecResultSystemError: Self = Self(300);
79
80 pub const ExecResultUnrecoverable: Self = Self(400);
83}
84impl From<i32> for ExecResult {
85 fn from(v: i32) -> Self {
86 Self(v)
87 }
88}
89#[cfg(feature = "std")]
90impl core::fmt::Display for ExecResult {
91 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
92 match self.0 {
93 x if x == Self::ExecResultOK.0 => {
94 write!(f, "ExecResult::ExecResultOK")
95 },
96 x if x == Self::ExecResultTxDeterministicError.0 => {
97 write!(f, "ExecResult::ExecResultTxDeterministicError")
98 },
99 x if x == Self::ExecResultTxRootFrameReverted.0 => {
100 write!(f, "ExecResult::ExecResultTxRootFrameReverted")
101 },
102 x if x == Self::ExecResultTxNonDeterministicError.0 => {
103 write!(f, "ExecResult::ExecResultTxNonDeterministicError")
104 },
105 x if x == Self::ExecResultFailedGasSponsorship.0 => {
106 write!(f, "ExecResult::ExecResultFailedGasSponsorship")
107 },
108 x if x == Self::ExecResultTxValidationFailure.0 => {
109 write!(f, "ExecResult::ExecResultTxValidationFailure")
110 },
111 x if x == Self::ExecResultMalformedTransaction.0 => {
112 write!(f, "ExecResult::ExecResultMalformedTransaction")
113 },
114 x if x == Self::ExecResultSystemError.0 => {
115 write!(f, "ExecResult::ExecResultSystemError")
116 },
117 x if x == Self::ExecResultUnrecoverable.0 => {
118 write!(f, "ExecResult::ExecResultUnrecoverable")
119 },
120 _ => {
121 write!(f, "ExecResult({})", self.0)
122 }
123 }
124 }
125}
126
127
128
129