Struct flaggy::Values

source ·
pub struct Values { /* private fields */ }
Expand description

Values is a structure which contains all of the parsed command-line flag values (or the default values for those flags). If parsing fails (including if some required flags weren’t specified, for example), an error is returned.

This structure provides various accessor functions, to conveniently get at the flag values. These accessors tend to follow the pattern of assuming the caller is doing things correctly, and that the caller wants us to panic early if something goes wrong. If this is not the desired behavior, the Values::get accessor provides a safe API where the caller can do their own error handling.

Implementations§

Construct a new Values structure using the given default values, and the given values parsed from the program’s command-line flags.

Returns whether or not there exists a Value for the given flag.

Return the Value(s) of a single flag, as strings. The returned vector might be empty (if there is no Value associated with the flag), or it might contain exactly one entry (in the case of named or boolean flags), or it might contain many entries (in the case of positional flags).

Return the Value(s) of a single flag, parsed into the given type. This is a convenience wrapper around get.

Trait Implementations§

Formats the value using the given formatter. Read more
Converts to this type from the input type.
Creates a value from an iterator. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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 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.