pub trait DeepVariants: Sized + 'static {
const DEEP_VARIANTS: &'static [Self];
}Expand description
Types that expose every reachable value as a compile-time constant slice.
The companion DeepVariants
derive macro implements this trait for an enum whose variants are
either unit variants or singleton tuple variants over types that also
implement DeepVariants.
§Example
use enum_tree::DeepVariants;
#[derive(DeepVariants, PartialEq, Eq, Debug)]
enum Light
{
Red,
Yellow,
Green,
}
assert_eq!(
Light::DEEP_VARIANTS,
&[Light::Red, Light::Yellow, Light::Green]
);Required Associated Constants§
Sourceconst DEEP_VARIANTS: &'static [Self]
const DEEP_VARIANTS: &'static [Self]
The flat list of every reachable variant value.
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.