pub struct Error { /* private fields */ }
Expand description
Represents an error encountered during argument parsing
Implementations
sourceimpl 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
.
Trait Implementations
sourceimpl Error for Error
impl Error for Error
sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
Auto Trait Implementations
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more