#[non_exhaustive]pub enum ParseError {
UnknownFlag {
flag: String,
},
MissingValue {
option: String,
},
MissingRequired {
arg: String,
},
UnknownCommand {
name: String,
},
UnexpectedArgument {
value: String,
},
HelpRequested(String),
VersionRequested(String),
Unauthorized {
command: String,
},
}std only.Expand description
A failure to parse command-line arguments.
Returned by App::try_parse_from. The variants
are marked #[non_exhaustive] so future versions can add cases (for example,
as the help and auth seams land) without a breaking change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnknownFlag
A -x / --name flag was given that no argument at this level declares.
MissingValue
An option that takes a value was given without one (it was the last token, or followed only by another option).
MissingRequired
A required argument was not provided.
UnknownCommand
A subcommand name was expected but the token matched no registered command.
UnexpectedArgument
A bare value was given that no positional argument or subcommand can accept.
HelpRequested(String)
Not an error: -h / --help was requested. Carries the rendered help
text. App::parse prints it to standard output and
exits 0; callers of
App::try_parse_from should do the same.
VersionRequested(String)
Not an error: -V / --version was requested. Carries the version
string. Handled like HelpRequested.
An auth-gated command (Command::requires_auth)
was invoked but the app’s auth hook did not authorize it (or no hook was
set). Produced only with the auth feature enabled; the command’s handler
does not run.
Fields
The command that was refused.
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
impl Eq for ParseError
Source§impl Error for ParseError
impl Error for ParseError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for ParseError
impl PartialEq for ParseError
Source§fn eq(&self, other: &ParseError) -> bool
fn eq(&self, other: &ParseError) -> bool
self and other values to be equal, and is used by ==.