Enum gong::analysis::ItemClass

source ·
pub enum ItemClass<'a> {
    Ok(Item<'a>),
    Warn(ItemW<'a>),
    Err(ItemE<'a>),
}
Expand description

The possible classes of items identified and extracted from command line arguments.

This breaks down items to three classes - okay/warn/error - with each variant holding an Item, ItemW or ItemE variant which more specifically represents what was found.

We use a class wrapper rather than grouping items into separate vectors because a single vector preserves order more simply. We break up item variants into groups for the advantages in matching.

All sub-variants hold a usize value to be used for indicating the index of the argument at which the item was found.

Most sub-variants also hold additional data. Long option sub-variants hold a string slice reference to the matched option. Short option sub-variants hold the char matched. Options with data arguments additionally hold a string slice reference to the data string matched, and in some cases also a DataLocation variant. The NonOption sub-variant holds a string slice reference to the matched string.

Variants§

§

Ok(Item<'a>)

Non-problematic item

§

Warn(ItemW<'a>)

Warn-level item

§

Err(ItemE<'a>)

Error-level item

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 tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. 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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
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.