variter
is a Rust crate that exports some simple tools for iterating
over enum
types with zero or more variants that have no fields.
```rust use variter::{VarIter, derivevariter}; derivevariter! { #[derive(Debug)] enum Greeting { Hello, Hola, Bonjour, } }
fn main() { for greeting in Greeting::ALL_VARIANTS.iter() { println!("{:?}", greeting); } } ```
If you're familiar with the Swift language, it's similar to using the
compiler-synthesized CaseIterable
protocol conformance.
See the module documentation for more information!
no_std
SupportGiven the simplicity of the crate, no_std
support can be found through the
default-features = false
flag in your Cargo.toml
dependency table.
```toml [dependencies]
variter = { version = "0.1", default-features = false } ```
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.