[][src]Struct libcli::args::Config

pub struct Config { /* fields omitted */ }

Specifies a configuration of parsed arguments Each option which was given as a spec can be accessed by option(name) This returns a Option<Vec> containing the values of the option (if any)

Implementations

impl Config[src]

Parses and generates configuration from supplied arguments and option specifications Can also generate usage strings

pub fn new_env(specs: &[OptionSpec]) -> Result<Config, String>[src]

Same as Config::new but uses the arguments passed to the program (env::args) The program path, first argument, is included in the unnamed args
Note, the spec isn't stored with config

pub fn new(args: &[&str], specs: &[OptionSpec]) -> Result<Config, String>[src]

Parses config from custom supplied arguments
Specs is a list containing specifications for the available options a use can supply
Returns Err(msg) if a spec doesn't match what is specified
The arguments before any option are specified with the (unnamed)
The values for the options can be accessed with the option(name) method
Parsing will fail if an option with policy other than Exact(0) is used twice Note, the spec isn't stored with config

pub fn generate_usage(
    specs: &[OptionSpec],
    list_required: bool,
    list_unrequired: bool
) -> String
[src]

Generates a usage string from supplied specs

pub fn option(&self, name: &str) -> Option<&Vec<String>>[src]

Auto Trait Implementations

impl RefUnwindSafe for Config

impl Send for Config

impl Sync for Config

impl Unpin for Config

impl UnwindSafe for Config

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.