Struct bdrck::flags::value::Values [] [src]

pub struct Values { /* fields omitted */ }

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.

Methods

impl Values
[src]

[src]

Constructs a new Values by parsing the flag values out of the given Iterator over command-line arguments, and using the given flag Specs.

[src]

Looks up a generic flag value, which may or may not be present. This function is guaranteed not to panic, but error handling and type matching is left up to the caller do deal with at runtime.

[src]

Lookup a single optional named flag value. This function panics if the flag has a value, but it is of the wrong type.

[src]

Lookup a required named flag value. This function panics if the value is not found, or if the flag with the given name is of the wrong type.

[src]

Lookup a required named flag value, moving the value into a new structure of the given type. A convenience wrapper around get_required.

[src]

Lookup a required named flag value, parsing the string into the given type. A convenience wrapper around get_required.

[src]

Lookup a boolean flag value. Boolean flags always have a value, since they have an implicit default value of false. This function panics if the value is not found, or if the flag with the given name is of the wrong type.

[src]

This function looks up a positional flag's values, returning the full (possibly empty) list of values. This function panics if no associated value list was found, or if the flag with the given name is of the wrong type.

[src]

This function looks up a positional flag's values, returning the only value in the list. This is most useful for non-variadic positional flags, which are always guaranteed to have exactly one value. This function panics if 0 or more than 1 value was found, or if the flag with the given name is of the wrong type.

Trait Implementations

impl Debug for Values
[src]

[src]

Formats the value using the given formatter.

impl Eq for Values
[src]

impl PartialEq for Values
[src]

[src]

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

[src]

This method tests for !=.

impl From<HashMap<String, Value>> for Values
[src]

[src]

Performs the conversion.

impl FromIterator<(String, Value)> for Values
[src]

[src]

Creates a value from an iterator. Read more