[−][src]Struct simple_arguments::Arguments
the main struct which is responsible for managing all argument parsing logic
Methods
impl<'a> Arguments<'a>
[src]
pub fn new(name: Option<&str>) -> Self
[src]
initialises a new Arguments
struct. You can give it an optional
executable name which will be used to create the usage String.
pub fn add<T, S>(&mut self, filler: T, name: S, description: &str) where
T: Filler + 'a,
S: ToString,
[src]
T: Filler + 'a,
S: ToString,
adds a new argument to the struct. filler must implement filler (all &mut T where T: FromStr implement Filler)
pub fn parse<S: AsRef<str>>(
&mut self,
arguments: &[S]
) -> Result<Vec<String>, String>
[src]
&mut self,
arguments: &[S]
) -> Result<Vec<String>, String>
fills every argument with the given arguments and returns a vector of all the arguments that weren't taken by any flag. If it fails, returns a string describing a parsing error or a lack of remaining arguments
pub fn usage(&self) -> String
[src]
generates a usage string
pub fn add_bool<S: ToString>(
&mut self,
b: &'a mut bool,
name: S,
description: &str
)
[src]
&mut self,
b: &'a mut bool,
name: S,
description: &str
)
since the default implementation of Filller for &mut bool would require
the user tu write ./program --boolean-flag true
instead of just
./program --boolean-flag
, this functions adds a flag that, when given,
will autmatically set the given variable to true
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Arguments<'a>
impl<'a> !Send for Arguments<'a>
impl<'a> !Sync for Arguments<'a>
impl<'a> Unpin for Arguments<'a>
impl<'a> !UnwindSafe for Arguments<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,