pub struct Argument {
pub strings: &'static [&'static str],
pub name: &'static str,
pub action: Action,
pub nargs: Nargs,
pub ty: Ty,
pub group: Option<usize>,
pub required: bool,
}Expand description
An argument (add_argument).
Fields§
§strings: &'static [&'static str]The option strings, in the order they are declared; empty for a positional argument.
name: &'static strThe name of a positional argument in the messages (its metavar, or
dest).
action: ActionWhat it does.
nargs: NargsHow many values it takes.
ty: TyThe type of its values.
group: Option<usize>Its mutually exclusive group, if any.
required: boolWhether it is required.
Implementations§
Source§impl Argument
impl Argument
Sourcepub const fn flag(strings: &'static [&'static str]) -> Self
pub const fn flag(strings: &'static [&'static str]) -> Self
action="store_true" (or store_false).
Sourcepub const fn append(strings: &'static [&'static str]) -> Self
pub const fn append(strings: &'static [&'static str]) -> Self
action="append": an option with one value, which may be given more
than once.
Sourcepub const fn positional(name: &'static str) -> Self
pub const fn positional(name: &'static str) -> Self
A positional argument with one value, named name in the messages.
Sourcepub const fn nargs(self, nargs: Nargs) -> Self
pub const fn nargs(self, nargs: Nargs) -> Self
nargs=; a positional argument is required unless it takes "?" or
"*".
Trait Implementations§
Auto Trait Implementations§
impl Forget for Argument
impl Freeze for Argument
impl Move for Argument
impl RefUnwindSafe for Argument
impl Send for Argument
impl Sync for Argument
impl Unpin for Argument
impl UnsafeUnpin for Argument
impl UnwindSafe for Argument
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more