[][src]Trait auto_args::AutoArgs

pub trait AutoArgs: Sized {
    const REQUIRES_INPUT: bool;

    fn parse_internal(
        key: &str,
        args: &mut Vec<OsString>
    ) -> Result<Self, Error>;
fn tiny_help_message(key: &str) -> String; fn from_args() -> Self { ... }
fn parse_vec(args: Vec<OsString>) -> Result<Self, Error> { ... }
fn from_iter<I, T>(args: I) -> Result<Self, Error>
    where
        I: IntoIterator<Item = T>,
        T: Into<OsString> + Clone
, { ... }
fn help_message(key: &str, doc: &str) -> String { ... }
fn usage() -> String { ... }
fn help() -> String { ... } }

The primary trait, which is implemented by any type which may be part of your command-line flags.

Associated Constants

const REQUIRES_INPUT: bool

Indicates whether this type requires any input.

This is false if the data may be processed with no input, true otherwise.

Loading content...

Required methods

fn parse_internal(key: &str, args: &mut Vec<OsString>) -> Result<Self, Error>

For implementation, but not for using this library.

Parse this flag from the arguments, and return the set of remaining arguments if it was successful. Otherwise return an error message indicating what went wrong. The prefix is a string that should be inserted prior to a flag name.

fn tiny_help_message(key: &str) -> String

Return a tiny help message.

Loading content...

Provided methods

fn from_args() -> Self

Parse the command-line arguments, exiting in case of error.

This is what users actually use.

fn parse_vec(args: Vec<OsString>) -> Result<Self, Error>

Parse a Vec of arguments as if they were command line flags

This mimics what we would do if we were doing the real parsing, except that we don't exit on error.

fn from_iter<I, T>(args: I) -> Result<Self, Error> where
    I: IntoIterator<Item = T>,
    T: Into<OsString> + Clone

Parse arguments given through an iterable thing such as a Vec or a slice, ignoring first element.

fn help_message(key: &str, doc: &str) -> String

Return a help message.

fn usage() -> String

Usage text for the actual command

fn help() -> String

Help text for the actual command

Loading content...

Implementations on Foreign Types

impl AutoArgs for String[src]

impl AutoArgs for Vec<String>[src]

impl AutoArgs for PathBuf[src]

impl AutoArgs for Vec<PathBuf>[src]

impl AutoArgs for bool[src]

impl<T: AutoArgs> AutoArgs for Option<T>[src]

impl AutoArgs for u8[src]

impl AutoArgs for Vec<u8>[src]

impl AutoArgs for u16[src]

impl AutoArgs for Vec<u16>[src]

impl AutoArgs for u32[src]

impl AutoArgs for Vec<u32>[src]

impl AutoArgs for u64[src]

impl AutoArgs for Vec<u64>[src]

impl AutoArgs for usize[src]

impl AutoArgs for Vec<usize>[src]

impl AutoArgs for i8[src]

impl AutoArgs for Vec<i8>[src]

impl AutoArgs for i16[src]

impl AutoArgs for Vec<i16>[src]

impl AutoArgs for i32[src]

impl AutoArgs for Vec<i32>[src]

impl AutoArgs for i64[src]

impl AutoArgs for Vec<i64>[src]

impl AutoArgs for isize[src]

impl AutoArgs for Vec<isize>[src]

impl AutoArgs for f64[src]

impl AutoArgs for Vec<f64>[src]

impl AutoArgs for f32[src]

impl AutoArgs for Vec<f32>[src]

impl<T> AutoArgs for PhantomData<T>[src]

Loading content...

Implementors

Loading content...