pub trait EveryVariant: Sized {
// Required method
fn every_variant() -> Vec<Self>;
// Provided method
fn for_every_variant<F: Fn(&Self)>(closure: F) { ... }
}Expand description
Trait that supplies a function to generate a vector containing all possible variants in a tree
Required Methods§
Sourcefn every_variant() -> Vec<Self>
fn every_variant() -> Vec<Self>
A vector of variants that should contain every possible variant of the struct or enum
Provided Methods§
Sourcefn for_every_variant<F: Fn(&Self)>(closure: F)
fn for_every_variant<F: Fn(&Self)>(closure: F)
Helper function, loops of each variant in an enum. Else does nothing.
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.