pub struct Arg<'a> {
pub key: u64,
pub required: bool,
pub var: bool,
pub var_max: Option<u32>,
pub delimiter: Option<u8>,
pub allow_negative_numbers: bool,
pub value_terminator: Option<&'a [u8]>,
pub double_dash: DoubleDash,
pub name: &'a str,
}Expand description
A positional argument.
Fields§
§key: u64Caller-assigned identifier, echoed back in Event::Arg. See
Command::key on why it is this wide.
required: boolWhether post-binding requires this positional to have a value. Kept in the hot
table because allow_missing_positional must reserve words for later required args.
var: boolWhether this argument keeps taking values once it has one.
var_max: Option<u32>How many words a variadic may take before the next argument gets the rest.
A bound belongs here, in the table binding reads, rather than with the metadata:
it decides where a word lands, not whether what landed is acceptable. clap’s
num_args works the same way, and every spec in the wild is generated from a clap
command. u32 rather than usize because a CLI that bounds a variadic above four
billion has other problems, and this table is read on the hot path.
delimiter: Option<u8>The byte that makes one word several values, if the argument declares one.
See Flag::delimiter: a bound counts values, and only this says how many values a
word carries.
allow_negative_numbers: boolWhether a negative-number token is accepted as this positional even in strict flag mode.
value_terminator: Option<&'a [u8]>A token that ends this variadic positional without becoming a value.
double_dash: DoubleDashThis argument’s relationship to the -- separator.
name: &'a strUnused by binding, kept so a table entry can carry its own name for diagnostics.