pub struct Error { /* private fields */ }Expand description
Represents an error encountered during argument parsing
Implementations§
Source§impl Error
impl Error
Sourcepub fn failed_parse(opt: Opt<'_>, err: String) -> Error
pub fn failed_parse(opt: Opt<'_>, err: String) -> Error
Returns an error for a failed attempt at parsing an option value.
Sourcepub fn failed_parse_default(
option: &'static str,
value: &'static str,
err: String,
) -> Error
pub fn failed_parse_default( option: &'static str, value: &'static str, err: String, ) -> Error
Returns an error for a failed attempt at parsing an option’s default value.
Sourcepub fn failed_parse_with_name(name: String, err: String) -> Error
pub fn failed_parse_with_name(name: String, err: String) -> Error
Returns an error for a failed attempt at parsing an option value.
Sourcepub fn insufficient_arguments(
opt: Opt<'_>,
expected: usize,
found: usize,
) -> Error
pub fn insufficient_arguments( opt: Opt<'_>, expected: usize, found: usize, ) -> Error
Returns an error for an option expecting two or more arguments not receiving the expected number of arguments.
Sourcepub fn unexpected_argument(opt: Opt<'_>) -> Error
pub fn unexpected_argument(opt: Opt<'_>) -> Error
Returns an error for an option receiving an unexpected argument value,
e.g. --option=value.
Sourcepub fn unexpected_single_argument(opt: Opt<'_>, n: usize) -> Error
pub fn unexpected_single_argument(opt: Opt<'_>, n: usize) -> Error
Returns an error for an option expecting two or more argument values
receiving only one in the long form, e.g. --option=value.
These options must be passed as, e.g. --option value second-value [...].
Sourcepub fn missing_argument(opt: Opt<'_>) -> Error
pub fn missing_argument(opt: Opt<'_>) -> Error
Returns an error for a missing required argument.
Sourcepub fn missing_command() -> Error
pub fn missing_command() -> Error
Returns an error for a missing command name.
Sourcepub fn missing_required(opt: &str) -> Error
pub fn missing_required(opt: &str) -> Error
Returns an error for a missing required option.
Sourcepub fn missing_required_command() -> Error
pub fn missing_required_command() -> Error
Returns an error for a missing required command.
Sourcepub fn missing_required_free() -> Error
pub fn missing_required_free() -> Error
Returns an error for a missing required free argument.
Sourcepub fn unexpected_free(arg: &str) -> Error
pub fn unexpected_free(arg: &str) -> Error
Returns an error when a free argument was encountered, but the options type does not support free arguments.
Sourcepub fn unrecognized_command(name: &str) -> Error
pub fn unrecognized_command(name: &str) -> Error
Returns an error for an unrecognized command.
Sourcepub fn unrecognized_option(opt: Opt<'_>) -> Error
pub fn unrecognized_option(opt: Opt<'_>) -> Error
Returns an error for an unrecognized option.
Sourcepub fn unrecognized_long(opt: &str) -> Error
pub fn unrecognized_long(opt: &str) -> Error
Returns an error for an unrecognized long option, e.g. --option.
Sourcepub fn unrecognized_short(opt: char) -> Error
pub fn unrecognized_short(opt: char) -> Error
Returns an error for an unrecognized short option, e.g. -o.