pub enum ParseError {
Lex(LexError),
UnknownVerb(String),
MissingArgument {
verb: &'static str,
name: &'static str,
},
InvalidArgument {
verb: &'static str,
name: &'static str,
reason: String,
},
UnknownFlag {
verb: &'static str,
flag: String,
},
TooManyArguments {
verb: &'static str,
expected: usize,
actual: usize,
},
}Expand description
Why a line could not be parsed into a Command.
Variants§
Lex(LexError)
UnknownVerb(String)
MissingArgument
InvalidArgument
UnknownFlag
TooManyArguments
More positional arguments were given than the verb accepts. Without
this check, extras are silently discarded by index-based lookup
(Args::positional) — e.g. rm /a /b would remove only /a and
report success, with /b vanishing with no error or warning. This
makes that fail loudly instead, matching the parser’s design
principle of never guessing intent (the same principle behind
check_known_flags rejecting unknown flags).
Trait Implementations§
Source§impl Debug for ParseError
impl Debug for ParseError
impl Eq for ParseError
Source§impl From<LexError> for ParseError
impl From<LexError> for ParseError
Source§impl PartialEq for ParseError
impl PartialEq for ParseError
impl StructuralPartialEq for ParseError
Auto Trait Implementations§
impl Freeze for ParseError
impl RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnsafeUnpin for ParseError
impl UnwindSafe for ParseError
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