VariantList

Trait VariantList 

Source
pub trait VariantList{
    const VARIANTS: [&'static str; Self::VARIANT_COUNT];

    // Required method
    fn variant_index(&self) -> usize;

    // Provided method
    fn variant_name(&self) -> String { ... }
}
Expand description

An enum trait that allows getting the index of its variant and thereby the name of the variant.

Required Associated Constants§

Required Methods§

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.

Implementors§