pub struct ParseResult { /* private fields */ }Expand description
Represents the result of a parse operation and provides a set of methods to query over the values.
Implementations§
Source§impl ParseResult
impl ParseResult
Sourcepub fn new(command: Command, options: OptionList, args: ArgumentList) -> Self
pub fn new(command: Command, options: OptionList, args: ArgumentList) -> Self
Constructs a new ParseResult.
Sourcepub fn command_name(&self) -> &str
pub fn command_name(&self) -> &str
Returns the name of the executing command.
Sourcepub fn command_version(&self) -> Option<&str>
pub fn command_version(&self) -> Option<&str>
Returns the version of the executing command or None.
Sourcepub fn command_help(&self) -> Option<&str>
pub fn command_help(&self) -> Option<&str>
Returns the help message of the executing command or None.
Sourcepub fn command_usage(&self) -> Option<&str>
pub fn command_usage(&self) -> Option<&str>
Returns the usage message of the executing command or None.
Sourcepub fn options(&self) -> &OptionList
pub fn options(&self) -> &OptionList
Returns the Options passed to the executing command.
Sourcepub fn arg(&self) -> Option<&Argument>
pub fn arg(&self) -> Option<&Argument>
Returns the Argument passed to the executing command or None is there is more than 1 argument.
Sourcepub fn args(&self) -> &ArgumentList
pub fn args(&self) -> &ArgumentList
Returns the Arguments passed to the executing command.
Sourcepub fn value_of(&self, arg_name: &str) -> Option<&str>
pub fn value_of(&self, arg_name: &str) -> Option<&str>
Gets the value of the argument with the given name.
Sourcepub fn values_of(&self, arg_name: &str) -> Option<Values<'_>>
pub fn values_of(&self, arg_name: &str) -> Option<Values<'_>>
Gets an iterator over the values of the argument with the given name.
Sourcepub fn value_of_option(&self, option_name: &str) -> Option<&str>
pub fn value_of_option(&self, option_name: &str) -> Option<&str>
Gets the value of the argument of the given option.
Sourcepub fn values_of_option(&self, option_name: &str) -> Option<Values<'_>>
pub fn values_of_option(&self, option_name: &str) -> Option<Values<'_>>
Gets an iterator over the values of the arguments of the given option.
Sourcepub fn value_of_as<T>(&self, arg_name: &str) -> Option<T>
pub fn value_of_as<T>(&self, arg_name: &str) -> Option<T>
Gets the value of the argument with the given name as a type T.
Sourcepub fn values_of_as<T>(&self, arg_name: &str) -> Option<Vec<T>>
pub fn values_of_as<T>(&self, arg_name: &str) -> Option<Vec<T>>
Gets the values of the argument as a Vec<T>.
Sourcepub fn value_of_option_as<T>(&self, option_name: &str) -> Option<T>
pub fn value_of_option_as<T>(&self, option_name: &str) -> Option<T>
Gets the value of the argument of the given option as a type T.
Trait Implementations§
Source§impl Clone for ParseResult
impl Clone for ParseResult
Source§fn clone(&self) -> ParseResult
fn clone(&self) -> ParseResult
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more