Registry / utility / enum-iterator

enum-iterator

JSON →
library2.3.0rscratesunverified

Tools to iterate over all values of a type (e.g. all variants of an enumeration).

# Cargo.toml [dependencies] enum-iterator = "2.3.0"
INSTALL
IMPORT
SIG · ENUM-ITERATOR
E
enum-iterator
utilityrustv2.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

all
use enum_iterator::all;

Iterates over all variants of an enum using the `Sequence` derive macro.

use enum_iterator::all; #[derive(enum_iterator::Sequence)] enum Color { Red, Green, Blue } fn main() { for color in all::<Color>() { println!("{:?}", color); } }
Debug
Known issues
gotchaRequires the `Sequence` derive macro from the crate.
fix
Add `use enum_iterator::Sequence;` and derive `Sequence` on the enum.
affects: >=1.0.0
Upgrade
Version history
2.3.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
enum-iterator — cargo add enum-iterator · libregistry