Enum jargon_args::Key[][src]

pub enum Key {
    Dual {
        char: char,
        s_txt: char,
        l_txt: String,
    },
    Long {
        char: char,
        txt: String,
    },
    Short {
        char: char,
        txt: char,
    },
    Sub {
        txt: String,
    },
}
Expand description

Key

This is the Key enum that represents processable arguments. This has four variants.

Dual

Key::Dual represents ONLY Key::Long and Key::Short in one, they both must start with the same character.

let key: jargon_args::Key = ["-a", "--all"].into();
assert!(key.is_dual())

Long

Key::Long represents a full name argument like --all.

let key: jargon_args::Key = "--all".into();
assert!(key.is_long())

Short

Key::Short represents a single letter argument like -a.

let key: jargon_args::Key = "-a".into();
assert!(key.is_short())

sub

Key::Sub represents a subcommand argument, anything not converted into any other time becomes Key::Sub.

let key: jargon_args::Key = "list".into();
assert!(key.is_sub())

Variants

Dual

Dual

Key::Dual represents ONLY Key::Long and Key::Short in one, they both must start with the same character.

let key: jargon_args::Key = ["-a", "--all"].into();
assert!(key.is_dual())

Fields of Dual

char: char

The character at the beginning of each argument.

s_txt: char

The single character for the short argument.

l_txt: String

The word for the long argument.

Long

Long

Key::Long represents a full name argument like --all.

let key: jargon_args::Key = "--all".into();
assert!(key.is_long())

Fields of Long

char: char

The character at the beginning of the argument.

txt: String

The word for the argument.

Short

Short

Key::Short represents a single letter argument like -a.

let key: jargon_args::Key = "-a".into();
assert!(key.is_short())

Fields of Short

char: char

The character at the beginning of the argument.

txt: char

The character for the argument.

Sub

sub

Key::Sub represents a subcommand argument, anything not converted into any other time becomes Key::Sub.

let key: jargon_args::Key = "list".into();
assert!(key.is_sub())

Fields of Sub

txt: String

The word for the subcommand.

Implementations

Return the char at the beginning of each argument, Key::sub returns \0.

Returns only the text of each argument as String. --all is all.

Returns true if Key is Key::Dual.

Returns true if Key is Key::Long.

Returns true if Key is Key::Short.

Returns true if Key is Key::Sub.

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

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

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

Converts the given value to a String. 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.