Struct parg::Arg [−][src]
pub struct Arg { /* fields omitted */ }
Expand description
This structure represents an Argument for the command line in the form “–arg_name value”.
Implementations
Get the name of the Arg
.
Example
// match the optional i32 argument --foo <value> let arg = Arg::with_value("foo", Type::ReadAsI32, false); assert_eq!(arg.get_name(), String::from("foo"));
Construct an Arg
expecting a value and having a default one.
Arguments
name
- The name of the argument.reading_type
- The expectedType
of the argument.default_value
- The default value of the argument.required
- Check if whether or not the argument is required.
Example
// match the optional i32 argument --foo <value> let arg = Arg::with_default_value("foo", Type::ReadAsI32, Box::new(42i32), false);
Construct an Arg
expecting a value.
Arguments
name
- The name of the argument.reading_type
- The expectedType
of the argument.required
- Check if whether or not the argument is required.
Example
// match the optional i32 argument --foo <value> let arg = Arg::with_value("foo", Type::ReadAsI32, false);
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Arg
impl !UnwindSafe for Arg