#[non_exhaustive]pub enum UsageErr {
Show 27 variants
InvalidFlag {
token: String,
reason: String,
span: SourceSpan,
input: String,
},
MissingFlag(String),
DuplicateFlag(String),
MissingGroup {
group: String,
members: String,
},
InvalidInput(String, SourceSpan, NamedSource<String>),
MissingArg(String),
MissingSubcommand(String, String),
ArgRequiresDoubleDash(String),
Help(String),
Version(String),
Miette(MietteError),
IO(Error),
Strum(ParseError),
FromUtf8Error(FromUtf8Error),
TeraError(Error),
KdlError(KdlError),
FileError(Error, PathBuf),
ShellError(String),
VarArgTooFew {
name: String,
min: usize,
got: usize,
},
VarArgTooMany {
name: String,
max: usize,
got: usize,
},
VarFlagTooFew {
name: String,
min: usize,
got: usize,
},
VarFlagTooMany {
name: String,
max: usize,
got: usize,
},
InvalidPath(String),
InvalidView(String),
InvalidValue {
name: String,
value: String,
reason: String,
},
UnsupportedShell(String),
MissingMountOutput(String),
}Expand description
Everything that can go wrong reading a spec or a command line against one.
#[non_exhaustive], so a caller matching on it needs a _ arm. That is the point:
this enum grows every time the spec learns to say something new — MissingGroup
arrived with groups, ArgRequiresDoubleDash with double_dash — and without this
each one is a major release for everyone downstream.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidFlag
MissingFlag(String)
DuplicateFlag(String)
MissingGroup
A required group had none of its members given.
Its own variant rather than a UsageErr::MissingFlag holding a sentence,
because there is no one flag to name: the group is the thing that was not
satisfied, and a caller that renders errors itself needs the members as members.
InvalidInput(String, SourceSpan, NamedSource<String>)
MissingArg(String)
MissingSubcommand(String, String)
A command that declares subcommand_required was given none.
The spec could say this and the parser did not read it, so mise generate — which
declares it — parsed as though it were a complete invocation. usage-argv and clap both
refuse it.
ArgRequiresDoubleDash(String)
Help(String)
Version(String)
Miette(MietteError)
IO(Error)
Strum(ParseError)
FromUtf8Error(FromUtf8Error)
TeraError(Error)
KdlError(KdlError)
FileError(Error, PathBuf)
A file the spec model was asked to read could not be read.
Carries the path as well as the io error: “No such file or directory” on its own names nothing, and this is reported for spec files given on a command line.
ShellError(String)
A run= script could not be run, exited non-zero, or produced output usage
could not read. The message names the shell and the script.
VarArgTooFew
VarArgTooMany
VarFlagTooFew
VarFlagTooMany
InvalidPath(String)
InvalidView(String)
InvalidValue
UnsupportedShell(String)
MissingMountOutput(String)
Trait Implementations§
Source§impl Diagnostic for UsageErr
impl Diagnostic for UsageErr
Source§fn code(&self) -> Option<Box<dyn Display + '_>>
fn code(&self) -> Option<Box<dyn Display + '_>>
Diagnostic. Ideally also globally unique, and documented
in the toplevel crate’s documentation for easy searching. Rust path
format (foo::bar::baz) is recommended, but more classic codes like
E0123 or enums will work just fine.Source§fn help(&self) -> Option<Box<dyn Display + '_>>
fn help(&self) -> Option<Box<dyn Display + '_>>
Diagnostic. Do you have any
advice for the poor soul who’s just run into this issue?Source§fn severity(&self) -> Option<Severity>
fn severity(&self) -> Option<Severity>
ReportHandlers to change the display format
of this diagnostic. Read moreSource§fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
Diagnostic’s Diagnostic::source_codeSource§fn source_code(&self) -> Option<&dyn SourceCode>
fn source_code(&self) -> Option<&dyn SourceCode>
Diagnostic’s Diagnostic::labels to.Diagnostics.Source§fn url(&self) -> Option<Box<dyn Display + '_>>
fn url(&self) -> Option<Box<dyn Display + '_>>
Diagnostic.Source§fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
Source§impl Error for UsageErr
impl Error for UsageErr
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 From<FromUtf8Error> for UsageErr
impl From<FromUtf8Error> for UsageErr
Source§fn from(source: FromUtf8Error) -> Self
fn from(source: FromUtf8Error) -> Self
Source§impl From<MietteError> for UsageErr
impl From<MietteError> for UsageErr
Source§fn from(source: MietteError) -> Self
fn from(source: MietteError) -> Self
Source§impl From<ParseError> for UsageErr
impl From<ParseError> for UsageErr
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for UsageErr
impl !UnwindSafe for UsageErr
impl Freeze for UsageErr
impl Send for UsageErr
impl Sync for UsageErr
impl Unpin for UsageErr
impl UnsafeUnpin for UsageErr
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more