Struct rargsxd::ArgParser[][src]

pub struct ArgParser {
    pub name: String,
    pub author: String,
    pub version: String,
    pub copyright: String,
    pub info: String,
    pub usage: String,
    pub require_args: bool,
    pub extra: Vec<String>,
    // some fields omitted
}
Expand description

The main class for parsing

Fields

name: String

The name of the program

author: String

The author of the program

version: String

The version of the program

copyright: String

Copyright string

info: String

Simple description of the program

usage: String

Example usage of the program

require_args: bool

Whether the program has to have arguments passed or not

extra: Vec<String>

Any extra arguments that were passed, but not parsed

Implementations

Creates a new ArgParser using the first argument (the program) as the name. Creates help and version args by default

Creates a new ArgParser, with . Creates help and version args by default

Sets the author

Sets the version

Sets the copyright

Sets the info

Sets the usage. Replaces all instances of {name} with the program’s name.

Sets whether the program needs arguments or not

Adds the Vec<&mut Arg> to the parser’s args

Returns a copy of the parser’s current arguments in HashMap form using the ArgVal struct

Returns a copy of the parser’s current arguments in HashMap form using tuples

Gets a String value arg by . If no arg is found, default to String::new()

Gets a bool value arg by . If no arg is found, default to false

Parse with env::args()

Parses a given Vec

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.