Skip to main content

ArgumentParser

Trait ArgumentParser 

Source
pub trait ArgumentParser {
    // Required methods
    fn contains(&self, arg: &str) -> bool;
    fn get_all(
        &self,
        arg: &str,
        has_value: bool,
    ) -> Vec<(RangeInclusive<usize>, String)>;
}
Expand description

Helper trait to provide simple argument parsing over Vec<String>.

Required Methods§

Source

fn contains(&self, arg: &str) -> bool

Check whether an argument flag exists, either as a standalone flag or in --flag=value form.

Source

fn get_all( &self, arg: &str, has_value: bool, ) -> Vec<(RangeInclusive<usize>, String)>

Extract all occurrences of an argument and their values.

When has_value is true, this matches --flag value and --flag=value forms and returns the value part. When has_value is false, it matches bare flags like --flag.

Implementations on Foreign Types§

Source§

impl ArgumentParser for Vec<String>

Source§

fn contains(&self, arg: &str) -> bool

Source§

fn get_all( &self, arg: &str, has_value: bool, ) -> Vec<(RangeInclusive<usize>, String)>

Implementors§