pub enum Error {
User(String),
UserAny(Box<dyn Error + Send + Sync + 'static>),
Parse(String),
ExitMsg {
code: i32,
message: Option<String>,
},
UnknownOption {
token: String,
suggestions: Vec<String>,
},
UnknownCommand {
token: String,
suggestions: Vec<String>,
},
MissingValue {
opt: String,
},
UnexpectedPositional {
token: String,
},
}Expand description
Top-level error type.
Variants§
User(String)
Invalid CLI input (unknown flag, bad value, missing value, etc.).
UserAny(Box<dyn Error + Send + Sync + 'static>)
Arbitrary user error bubbled from callbacks.
Parse(String)
Internal/structural error (should be rare).
ExitMsg
Exit with a specific code (e.g., --help). Optional message payload.
UnknownOption
Rich diagnostics
UnknownCommand
MissingValue
UnexpectedPositional
Implementations§
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
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