thruput_xdr/
syscall_error.rs1#![allow(non_camel_case_types)]
9#![allow(non_snake_case)]
10#![allow(non_upper_case_globals)]
11#![allow(unused_imports)]
12#![allow(dead_code)]
13#![allow(unused_variables)]
14#![allow(clippy::unnecessary_cast)]
15
16use crate::*;
17use core::option::Option;
18use core::ops::{Deref, DerefMut};
19
20#[cfg(feature = "std")]
21use std::io::{Read, Write};
22#[cfg(feature = "xdrs")]
23use xdrs::*;
24
25
26#[cfg(feature = "serde")]
27use ::serde::{{Serialize, Deserialize}};
28
29
30#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
38#[cfg_attr(feature = "serde", serde(transparent))]
39#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
40#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
41#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
42#[derive(Copy)]
43#[repr(transparent)]
44pub struct SyscallErrorCode(pub i32);
45
46impl SyscallErrorCode {
47 pub const kSyscallErrorCodeNone: Self = Self(0);
49
50 pub const kSyscallErrorCodeFault: Self = Self(1);
52
53 pub const kSyscallErrorCodeNoSyscall: Self = Self(2);
55
56 pub const kSyscallErrorCodeIsRootTransaction: Self = Self(3);
58
59 pub const kSyscallErrorCodeReentrance: Self = Self(4);
61
62 pub const kSyscallErrorCodeContractAlreadyDeployed: Self = Self(5);
65
66 pub const kSyscallErrorCodeNoReturnBufferAvailable: Self = Self(6);
69
70 pub const kSyscallErrorCodeInvalidSyscallInput: Self = Self(7);
73
74 pub const kSyscallErrorCodeStorageKeyNotExist: Self = Self(8);
76
77 pub const kSyscallErrorCodeNoRetrocausalQueueEntry: Self = Self(9);
79
80 pub const kSyscallErrorCodeRetrocausalQueueReadLimitReached: Self = Self(10);
86
87 pub const kSyscallErrorCodeInvokeDepthExceeded: Self = Self(11);
95}
96impl From<i32> for SyscallErrorCode {
97 fn from(v: i32) -> Self {
98 Self(v)
99 }
100}
101#[cfg(feature = "std")]
102impl core::fmt::Display for SyscallErrorCode {
103 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
104 match self.0 {
105 x if x == Self::kSyscallErrorCodeNone.0 => {
106 write!(f, "SyscallErrorCode::kSyscallErrorCodeNone")
107 },
108 x if x == Self::kSyscallErrorCodeFault.0 => {
109 write!(f, "SyscallErrorCode::kSyscallErrorCodeFault")
110 },
111 x if x == Self::kSyscallErrorCodeNoSyscall.0 => {
112 write!(f, "SyscallErrorCode::kSyscallErrorCodeNoSyscall")
113 },
114 x if x == Self::kSyscallErrorCodeIsRootTransaction.0 => {
115 write!(f, "SyscallErrorCode::kSyscallErrorCodeIsRootTransaction")
116 },
117 x if x == Self::kSyscallErrorCodeReentrance.0 => {
118 write!(f, "SyscallErrorCode::kSyscallErrorCodeReentrance")
119 },
120 x if x == Self::kSyscallErrorCodeContractAlreadyDeployed.0 => {
121 write!(f, "SyscallErrorCode::kSyscallErrorCodeContractAlreadyDeployed")
122 },
123 x if x == Self::kSyscallErrorCodeNoReturnBufferAvailable.0 => {
124 write!(f, "SyscallErrorCode::kSyscallErrorCodeNoReturnBufferAvailable")
125 },
126 x if x == Self::kSyscallErrorCodeInvalidSyscallInput.0 => {
127 write!(f, "SyscallErrorCode::kSyscallErrorCodeInvalidSyscallInput")
128 },
129 x if x == Self::kSyscallErrorCodeStorageKeyNotExist.0 => {
130 write!(f, "SyscallErrorCode::kSyscallErrorCodeStorageKeyNotExist")
131 },
132 x if x == Self::kSyscallErrorCodeNoRetrocausalQueueEntry.0 => {
133 write!(f, "SyscallErrorCode::kSyscallErrorCodeNoRetrocausalQueueEntry")
134 },
135 x if x == Self::kSyscallErrorCodeRetrocausalQueueReadLimitReached.0 => {
136 write!(f, "SyscallErrorCode::kSyscallErrorCodeRetrocausalQueueReadLimitReached")
137 },
138 x if x == Self::kSyscallErrorCodeInvokeDepthExceeded.0 => {
139 write!(f, "SyscallErrorCode::kSyscallErrorCodeInvokeDepthExceeded")
140 },
141 _ => {
142 write!(f, "SyscallErrorCode({})", self.0)
143 }
144 }
145 }
146}
147
148
149
150