#![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::ops::{Deref, DerefMut};
use core::option::Option;
#[cfg(feature = "std")]
use std::io::{Read, Write};
use xdrs::*;
#[cfg(feature = "serde")]
use ::serde::{Deserialize, Serialize};
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
#[cfg_attr(feature = "serde", serde(transparent))]
#[derive(schemars::JsonSchema)]
#[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)
}
}
impl xdrs::XDRDiscriminant for InvokeErrorCode {
const ENCODING: xdrs::DiscriminantEncoding = xdrs::DiscriminantEncoding::Signed;
fn discriminant(&self) -> i32 {
self.0
}
fn from_discriminant(d: i32) -> Self {
Self(d)
}
}
#[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 => f.write_str("InvokeErrorCode::None"),
x if x == Self::Deterministic.0 => {
f.write_str("InvokeErrorCode::Deterministic")
}
x if x == Self::OutOfGas.0 => f.write_str("InvokeErrorCode::OutOfGas"),
x if x == Self::Unrecoverable.0 => {
f.write_str("InvokeErrorCode::Unrecoverable")
}
x if x == Self::ValidationFailure.0 => {
f.write_str("InvokeErrorCode::ValidationFailure")
}
x if x == Self::Abandon.0 => f.write_str("InvokeErrorCode::Abandon"),
_ => write!(f, "InvokeErrorCode({})", self.0),
}
}
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
#[cfg_attr(feature = "serde", serde(transparent))]
#[derive(schemars::JsonSchema)]
#[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)
}
}
impl xdrs::XDRDiscriminant for HostFnErrorCode {
const ENCODING: xdrs::DiscriminantEncoding = xdrs::DiscriminantEncoding::Signed;
fn discriminant(&self) -> i32 {
self.0
}
fn from_discriminant(d: i32) -> Self {
Self(d)
}
}
#[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 => {
f.write_str("HostFnErrorCode::NoneOrRecoverable")
}
x if x == Self::OutOfGas.0 => f.write_str("HostFnErrorCode::OutOfGas"),
x if x == Self::Unrecoverable.0 => {
f.write_str("HostFnErrorCode::Unrecoverable")
}
x if x == Self::Return.0 => f.write_str("HostFnErrorCode::Return"),
x if x == Self::Exit.0 => f.write_str("HostFnErrorCode::Exit"),
x if x == Self::ValidationFailure.0 => {
f.write_str("HostFnErrorCode::ValidationFailure")
}
x if x == Self::Abandon.0 => f.write_str("HostFnErrorCode::Abandon"),
_ => write!(f, "HostFnErrorCode({})", self.0),
}
}
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
#[cfg_attr(feature = "serde", serde(transparent))]
#[derive(schemars::JsonSchema)]
#[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)
}
}
impl xdrs::XDRDiscriminant for SystemErrorCode {
const ENCODING: xdrs::DiscriminantEncoding = xdrs::DiscriminantEncoding::Signed;
fn discriminant(&self) -> i32 {
self.0
}
fn from_discriminant(d: i32) -> Self {
Self(d)
}
}
#[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 => {
f.write_str("SystemErrorCode::Unrecoverable")
}
x if x == Self::Abandon.0 => f.write_str("SystemErrorCode::Abandon"),
x if x == Self::ValidationFailure.0 => {
f.write_str("SystemErrorCode::ValidationFailure")
}
_ => write!(f, "SystemErrorCode({})", self.0),
}
}
}