/
View dependency graph
Depends on
- dh-cargo (dh-sequence-cargo)
- cargo, debhelper-compat, librust-proc-macro2-1+default-dev, librust-quote-1+default-dev, librust-syn-2+default-dev, librust-syn-2+extra-traits-dev, libstd-rust-dev, rustc
README (full)
Procedural macro derive that mimics arg_enum! from clap
Usage
In Cargo.toml:
[dependencies]
arg_enum_proc_macro = "0.3"
In the rust code:
use arg_enum_proc_macro::ArgEnum;
/// All the possible states of Foo
#[derive(ArgEnum)]
pub enum Foo {
/// Initial state
Unk,
/// Foo is on
On,
/// Foo is off
Off,
}
Aliases
It is possible to express an alias using the attribute arg_enum(alias = "AliasVariant").
The FromStr will map the "AliasVariant" string to the decorated enum variant:
/// All the possible states of Foo
#[derive(ArgEnum)]
pub enum Foo {
/// Initial state
Unk,
/// Foo is on
#[arg_enum(alias = "Up")]
On,
/// Foo is off
#[arg_enum(alias = "Down")]
Off,
}
| dir | debian/ |
| dir | src/ |
| dir | tests/ |
| file | .cargo_vcs_info.json |
| file | .gitignore |
| file | Cargo.toml |
| file | Cargo.toml.orig |
| file | LICENSE |
| file | README.md |