2 unstable releases
0.2.0 | Oct 4, 2024 |
---|---|
0.1.0 | Oct 3, 2024 |
#865 in Rust patterns
393 downloads per month
17KB
256 lines
case_iterable
Installation
case_iterable
can be installed with cargo
:
$ cargo add case_iterable
or by manually adding it to your Cargo.toml
:
[dependencies]
case_iterable = "0.2.0"
Usage
use case_iterable::CaseIterable;
#[derive(CaseIterable)]
enum Foo {
A,
Bar,
Chocolate,
}
for variant in Foo::all_cases() {
// Foo::A
// Foo::Bar
// Foo::Chocolate
}
// also exposes the next function used for the iterator
let x = Foo::Bar;
let y = x.next(); // Some(Foo::Chocolate)
License
Licensed under GNU General Public License, Version 3.0 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.Dependencies
~245–700KB
~17K SLoC