pub struct ArgumentList { /* private fields */ }Expand description
List of arguments of an option or command.
Implementations§
Source§impl ArgumentList
impl ArgumentList
Sourcepub fn add(&mut self, arg: Argument) -> Result<(), Argument>
pub fn add(&mut self, arg: Argument) -> Result<(), Argument>
Adds an argument to the list, returns true if the argument was added
otherwise if is a duplicate returns false.
§Panics:
Panics if there is multiples options with default values.
Sourcepub fn get<S: AsRef<str>>(&self, arg_name: S) -> Option<&Argument>
pub fn get<S: AsRef<str>>(&self, arg_name: S) -> Option<&Argument>
Returns the Argument with the given name or None if no found.
Sourcepub fn get_raw_args(&self) -> RawArgs<'_> ⓘ
pub fn get_raw_args(&self) -> RawArgs<'_> ⓘ
Returns an iterator over the &str values of this ArgumentList.
Sourcepub fn get_raw_args_as_type<T>(&self) -> Result<Vec<T>>
pub fn get_raw_args_as_type<T>(&self) -> Result<Vec<T>>
Returns the values of all the arguments of this ArgumentList and convert them to type T.
§Error
If one of the value cannot be parse to T.
Sourcepub fn contains<S: AsRef<str>>(&self, arg_name: S) -> bool
pub fn contains<S: AsRef<str>>(&self, arg_name: S) -> bool
Returns true if contains an argument with the given name.
Sourcepub fn convert<T>(&self, arg_name: &str) -> Result<T>
pub fn convert<T>(&self, arg_name: &str) -> Result<T>
Converts the value of the Argument with the given name.
§Returns
Ok(T): If theStringvalue of the argument can be parse toT.Err(error):- If the argument cannot be found.
- If the value cannot be parse.
- if there no value to parse.
- if there is more than 1 value.
Sourcepub fn convert_at<T>(&self, index: usize) -> Result<T>
pub fn convert_at<T>(&self, index: usize) -> Result<T>
Trait Implementations§
Source§impl Clone for ArgumentList
impl Clone for ArgumentList
Source§fn clone(&self) -> ArgumentList
fn clone(&self) -> ArgumentList
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ArgumentList
impl Debug for ArgumentList
Source§impl Default for ArgumentList
impl Default for ArgumentList
Source§fn default() -> ArgumentList
fn default() -> ArgumentList
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ArgumentList
impl<'de> Deserialize<'de> for ArgumentList
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Self, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Self, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Index<&str> for ArgumentList
impl Index<&str> for ArgumentList
Source§impl Index<String> for ArgumentList
impl Index<String> for ArgumentList
Source§impl Index<usize> for ArgumentList
impl Index<usize> for ArgumentList
Source§impl<'a> IntoIterator for &'a ArgumentList
impl<'a> IntoIterator for &'a ArgumentList
Source§impl IntoIterator for ArgumentList
impl IntoIterator for ArgumentList
Source§impl PartialEq for ArgumentList
impl PartialEq for ArgumentList
Source§impl Serialize for ArgumentList
impl Serialize for ArgumentList
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for ArgumentList
impl StructuralPartialEq for ArgumentList
Auto Trait Implementations§
impl Freeze for ArgumentList
impl !RefUnwindSafe for ArgumentList
impl !Send for ArgumentList
impl !Sync for ArgumentList
impl Unpin for ArgumentList
impl !UnwindSafe for ArgumentList
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more