pub unsafe trait Enum:
DeserializeOwned
+ FromStr
+ Copy
+ 'static {
const COUNT: usize;
const VARIANTS: &'static [Self];
const NAMES: &'static [&'static str];
// Required method
fn discriminant(&self) -> usize;
// Provided methods
fn name(&self) -> &'static str { ... }
fn from_name(s: &str) -> Option<Self> { ... }
}
Required Associated Constants§
const COUNT: usize
const VARIANTS: &'static [Self]
const NAMES: &'static [&'static str]
Required Methods§
fn discriminant(&self) -> usize
Provided Methods§
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.