#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(unused_imports)]
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(clippy::unnecessary_cast)]
use crate::*;
use core::option::Option;
use core::ops::{Deref, DerefMut};
#[cfg(feature = "std")]
use std::io::{Read, Write};
#[cfg(feature = "xdrs")]
use xdrs::*;
#[cfg(feature = "serde")]
use ::serde::{{Serialize, Deserialize}};
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(Copy)]
#[repr(transparent)]
pub struct InvokeErrorCode(pub i32);
impl InvokeErrorCode {
pub const None: Self = Self(0);
pub const Deterministic: Self = Self(1);
pub const OutOfGas: Self = Self(2);
pub const Unrecoverable: Self = Self(3);
pub const ValidationFailure: Self = Self(4);
pub const Abandon: Self = Self(5);
}
impl From<i32> for InvokeErrorCode {
fn from(v: i32) -> Self {
Self(v)
}
}
#[cfg(feature = "std")]
impl core::fmt::Display for InvokeErrorCode {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self.0 {
x if x == Self::None.0 => {
write!(f, "InvokeErrorCode::None")
},
x if x == Self::Deterministic.0 => {
write!(f, "InvokeErrorCode::Deterministic")
},
x if x == Self::OutOfGas.0 => {
write!(f, "InvokeErrorCode::OutOfGas")
},
x if x == Self::Unrecoverable.0 => {
write!(f, "InvokeErrorCode::Unrecoverable")
},
x if x == Self::ValidationFailure.0 => {
write!(f, "InvokeErrorCode::ValidationFailure")
},
x if x == Self::Abandon.0 => {
write!(f, "InvokeErrorCode::Abandon")
},
_ => {
write!(f, "InvokeErrorCode({})", self.0)
}
}
}
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(Copy)]
#[repr(transparent)]
pub struct HostFnErrorCode(pub i32);
impl HostFnErrorCode {
pub const NoneOrRecoverable: Self = Self(0);
pub const OutOfGas: Self = Self(1);
pub const Unrecoverable: Self = Self(2);
pub const Return: Self = Self(3);
pub const Exit: Self = Self(4);
pub const ValidationFailure: Self = Self(5);
pub const Abandon: Self = Self(6);
}
impl From<i32> for HostFnErrorCode {
fn from(v: i32) -> Self {
Self(v)
}
}
#[cfg(feature = "std")]
impl core::fmt::Display for HostFnErrorCode {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self.0 {
x if x == Self::NoneOrRecoverable.0 => {
write!(f, "HostFnErrorCode::NoneOrRecoverable")
},
x if x == Self::OutOfGas.0 => {
write!(f, "HostFnErrorCode::OutOfGas")
},
x if x == Self::Unrecoverable.0 => {
write!(f, "HostFnErrorCode::Unrecoverable")
},
x if x == Self::Return.0 => {
write!(f, "HostFnErrorCode::Return")
},
x if x == Self::Exit.0 => {
write!(f, "HostFnErrorCode::Exit")
},
x if x == Self::ValidationFailure.0 => {
write!(f, "HostFnErrorCode::ValidationFailure")
},
x if x == Self::Abandon.0 => {
write!(f, "HostFnErrorCode::Abandon")
},
_ => {
write!(f, "HostFnErrorCode({})", self.0)
}
}
}
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(Copy)]
#[repr(transparent)]
pub struct SystemErrorCode(pub i32);
impl SystemErrorCode {
pub const Unrecoverable: Self = Self(1);
pub const Abandon: Self = Self(2);
pub const ValidationFailure: Self = Self(3);
}
impl From<i32> for SystemErrorCode {
fn from(v: i32) -> Self {
Self(v)
}
}
#[cfg(feature = "std")]
impl core::fmt::Display for SystemErrorCode {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self.0 {
x if x == Self::Unrecoverable.0 => {
write!(f, "SystemErrorCode::Unrecoverable")
},
x if x == Self::Abandon.0 => {
write!(f, "SystemErrorCode::Abandon")
},
x if x == Self::ValidationFailure.0 => {
write!(f, "SystemErrorCode::ValidationFailure")
},
_ => {
write!(f, "SystemErrorCode({})", self.0)
}
}
}
}