pub trait SqlEnum:
Sized
+ 'static
+ Clone {
type IntegerType: Display + TryInto<usize> + IntoSqlType;
const ENUM_NAME: &'static str;
const VARIANTS_IN_ORDER: &'static [Self];
// Required method
fn to_integer(self) -> Self::IntegerType;
// Provided method
fn from_integer(integer: Self::IntegerType) -> Result<Self> { ... }
}Expand description
An enum consisting of only empty variants, backed up by an integer type, which can be used in sql statements.
Required Associated Constants§
const ENUM_NAME: &'static str
Sourceconst VARIANTS_IN_ORDER: &'static [Self]
const VARIANTS_IN_ORDER: &'static [Self]
The variants of the enum, in order.
Required Associated Types§
Sourcetype IntegerType: Display + TryInto<usize> + IntoSqlType
type IntegerType: Display + TryInto<usize> + IntoSqlType
The smallest integer type needed to represent this enum.
Required Methods§
Sourcefn to_integer(self) -> Self::IntegerType
fn to_integer(self) -> Self::IntegerType
Converts a variant of this enum to an integer.
Provided Methods§
Sourcefn from_integer(integer: Self::IntegerType) -> Result<Self>
fn from_integer(integer: Self::IntegerType) -> Result<Self>
Converts an integer to a variant of this enum.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.