Struct jargon_args::Jargon[][src]

pub struct Jargon(_);
Expand description

Jargon

This is the main struct in this crate. This is what is used to handle arguments, and get arguments’ values.

Example

use jargon_args::Jargon;
let mut jargon: Jargon = Jargon::from_env();

if jargon.contains(["-h", "--help"]) {
    println!("help text");
    std::process::exit(0);
}

// ...

Implementations

Extracts a program’s arguments from the environment.

Places provided vector into Jargon. Please have the program’s name or subcommand’s name at index 0. 0 is always ignored.

Checks if provided key is given in arguments. Removes it.

Runs function that does not return a value if specified key exists. Removes the program’s name from provided vector.

Runs function that returns Option if specified key exists. Removes the program’s name from provided vector.

Runs function that returns Result<T, jargon_args::Error> if specified key exists. Removes the program’s name from provided vector.

Checks if key exists, removes it, and returns it and all remaining arguments in Some(Vec). None if key isn’t in arguments.

Checks for provided key in arguments, removes it, returns Some(String) with the value after it if there is one. None is there is no value.

Checks for provided key in arguments, removes it, returns Ok(String) with the value after it if there is one. Err(jargon_args::Error) is there is no value.

Drops your jargon instance and returns all remaining arguments.

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

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. 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.