pub struct Args { /* private fields */ }Expand description
A builder for type-safe command arguments.
Implementations§
Source§impl Args
impl Args
Sourcepub fn optional_flag(self, short: &'static str, long: &'static str) -> Self
pub fn optional_flag(self, short: &'static str, long: &'static str) -> Self
Adds an optional flag argument.
Sourcepub fn option(self, short: &'static str, long: &'static str) -> Self
pub fn option(self, short: &'static str, long: &'static str) -> Self
Adds an option argument (requires value).
Sourcepub fn optional_option(self, short: &'static str, long: &'static str) -> Self
pub fn optional_option(self, short: &'static str, long: &'static str) -> Self
Adds an optional option argument.
Sourcepub fn positional(self) -> Self
pub fn positional(self) -> Self
Adds a positional argument.
Sourcepub fn optional_positional(self) -> Self
pub fn optional_positional(self) -> Self
Adds an optional positional argument.
Sourcepub fn value<V: AsRef<OsStr>>(self, value: V) -> Result<Self, String>
pub fn value<V: AsRef<OsStr>>(self, value: V) -> Result<Self, String>
Sets the value for the last added argument that requires a value.
Sets the value for the last added argument that requires a value.
§Errors
Returns an error if no argument expects a value.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Args
impl RefUnwindSafe for Args
impl Send for Args
impl Sync for Args
impl Unpin for Args
impl UnsafeUnpin for Args
impl UnwindSafe for Args
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