pub struct Argument<'a> { /* private fields */ }Expand description
Stores the characteristics of the name command line argument.
Implementations§
Source§impl<'a> Argument<'a>
impl<'a> Argument<'a>
Sourcepub fn new(name: &'a str) -> Argument<'a>
pub fn new(name: &'a str) -> Argument<'a>
Create a new Argument that keeps the necessary information for an argument.
Sourcepub fn requires(self, other_arg: &'a str) -> Self
pub fn requires(self, other_arg: &'a str) -> Self
Add other_arg as a required parameter when self is specified.
Sourcepub fn forbids(self, args: Vec<&'a str>) -> Self
pub fn forbids(self, args: Vec<&'a str>) -> Self
Add other_arg as a forbidden parameter when self is specified.
Sourcepub fn takes_value(self, takes_value: bool) -> Self
pub fn takes_value(self, takes_value: bool) -> Self
If takes_value is true, then the user must provide a value for the
argument, otherwise that argument is a flag.
Sourcepub fn allow_multiple(self, allow_multiple: bool) -> Self
pub fn allow_multiple(self, allow_multiple: bool) -> Self
If allow_multiple is true, then the user can provide multiple values for the
argument (e.g –arg val1 –arg val2). It sets the takes_value option to true,
so the user must provides at least one value.
Sourcepub fn default_value(self, default_value: &'a str) -> Self
pub fn default_value(self, default_value: &'a str) -> Self
Keep a default value which will be used if the user didn’t provide a value for the argument.
Trait Implementations§
impl<'a> Eq for Argument<'a>
impl<'a> StructuralPartialEq for Argument<'a>
Auto Trait Implementations§
impl<'a> Freeze for Argument<'a>
impl<'a> RefUnwindSafe for Argument<'a>
impl<'a> Send for Argument<'a>
impl<'a> Sync for Argument<'a>
impl<'a> Unpin for Argument<'a>
impl<'a> UnwindSafe for Argument<'a>
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