pub struct Arg {
pub arg_type: ArgType,
pub short: Option<&'static str>,
pub long: Option<&'static str>,
pub required: bool,
pub value: Option<OsString>,
}Expand description
Represents a type-safe argument specification.
Fields§
§arg_type: ArgTypeThe argument type
short: Option<&'static str>Short form (e.g., -v)
long: Option<&'static str>Long form (e.g., --verbose)
required: boolWhether this argument is required
value: Option<OsString>The argument value (if any)
Implementations§
Source§impl Arg
impl Arg
Sourcepub fn flag(short: &'static str, long: &'static str) -> Self
pub fn flag(short: &'static str, long: &'static str) -> Self
Creates a new required flag argument.
Sourcepub fn optional_flag(short: &'static str, long: &'static str) -> Self
pub fn optional_flag(short: &'static str, long: &'static str) -> Self
Creates a new optional flag argument.
Sourcepub fn option(short: &'static str, long: &'static str) -> Self
pub fn option(short: &'static str, long: &'static str) -> Self
Creates a new required option argument.
Sourcepub fn optional_option(short: &'static str, long: &'static str) -> Self
pub fn optional_option(short: &'static str, long: &'static str) -> Self
Creates a new optional option argument.
Sourcepub fn positional() -> Self
pub fn positional() -> Self
Creates a new positional argument.
Sourcepub fn optional_positional() -> Self
pub fn optional_positional() -> Self
Creates a new optional positional argument.
Sourcepub fn to_strings(&self) -> Vec<OsString>
pub fn to_strings(&self) -> Vec<OsString>
Converts this argument to command-line strings.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Arg
impl RefUnwindSafe for Arg
impl Send for Arg
impl Sync for Arg
impl Unpin for Arg
impl UnsafeUnpin for Arg
impl UnwindSafe for Arg
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