Struct rargsxd::ArgParser[][src]

pub struct ArgParser {
    pub extra: Vec<String>,
    // some fields omitted
}
Expand description

The main class for parsing

Fields

extra: Vec<String>

Any extra arguments that were passed, but not parsed

Implementations

impl ArgParser[src]

pub fn from_argv0() -> Self[src]

Creates a new ArgParser using the first argument (the program) as the name. Creates help and version args by default

pub fn new(name: &str) -> Self[src]

Creates a new ArgParser, with . Creates help and version args by default

pub fn author(&mut self, s: &str) -> &mut Self[src]

Sets the author

pub fn version(&mut self, s: &str) -> &mut Self[src]

Sets the version

pub fn copyright(&mut self, s: &str) -> &mut Self[src]

Sets the copyright

pub fn info(&mut self, s: &str) -> &mut Self[src]

Sets the info

pub fn usage(&mut self, s: &str) -> &mut Self[src]

Sets the usage

pub fn require_args(&mut self, b: bool) -> &mut Self[src]

Sets whether the program needs arguments or not

pub fn args(&mut self, args: Vec<&mut Arg>) -> &mut Self[src]

Adds the Vec<&mut Arg> to the parser’s args

pub fn get_str(&self, name: &str) -> String[src]

Gets a String value arg by . If no arg is found, default to String::new()

pub fn get_bool(&self, name: &str) -> bool[src]

Gets a bool value arg by . If no arg is found, default to false

pub fn parse(&mut self) -> &mut Self[src]

Parse with env::args()

pub fn parse_vec(&mut self, args: Vec<String>) -> &mut Self[src]

Parses a given Vec

Trait Implementations

impl Clone for ArgParser[src]

fn clone(&self) -> ArgParser[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for ArgParser[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.