Trait ValueEnum
trait ValueEnum: Sized + Clone
Parse arguments into enums.
When deriving Parser, a field whose type implements ValueEnum can have the attribute
#[arg(value_enum)] which will
- Call [
EnumValueParser][crate::builder::EnumValueParser] - Allowing using the
#[arg(default_value_t)]attribute without implementingDisplay.
NOTE: Deriving requires the derive feature flag
Required Methods
fn value_variants<'a>() -> &'a [Self]All possible argument values, in display order.
fn to_possible_value(self: &Self) -> Option<PossibleValue>The canonical argument value.
The value is
Nonefor skipped variants.
Provided Methods
fn from_str(input: &str, ignore_case: bool) -> Result<Self, String>Parse an argument into
Self.
Implementors
impl ValueEnum for ColorChoice