Skip to main content

Args

Struct Args 

Source
pub struct Args {
    pub files: Vec<PathBuf>,
    /* private fields */
}
Expand description

A parsed command line: flags that were present, options with values, and the positionals.

Fields§

§files: Vec<PathBuf>

Implementations§

Source§

impl Args

Source

pub fn parse( argv: Vec<String>, flag_names: &[&str], option_names: &[&str], ) -> Result<Parsed, String>

flag_names take no value, option_names take the next argument or an = suffix.

Source

pub fn has(&self, name: &str) -> bool

Source

pub fn get(&self, name: &str) -> Option<&str>

Source

pub fn all(&self, name: &str) -> Vec<String>

Every value given for a repeatable option, in the order they were typed.

Source

pub fn parse_number<T: FromStr>(&self, name: &str) -> Result<Option<T>, String>

Auto Trait Implementations§

§

impl Freeze for Args

§

impl RefUnwindSafe for Args

§

impl Send for Args

§

impl Sync for Args

§

impl Unpin for Args

§

impl UnsafeUnpin for Args

§

impl UnwindSafe for Args

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.