pub enum CliError {
Usage(String),
ReadInput {
label: String,
kind: ErrorKind,
},
WriteOutput {
label: String,
kind: ErrorKind,
},
Codec(Error),
Format(String),
RawConfig(String),
}Expand description
A command-line failure, carrying enough context for a helpful message and a meaningful process exit code.
Variants§
Usage(String)
The arguments were used incorrectly (exit code 2, matching clap).
ReadInput
The input could not be read (exit code 3).
Fields
WriteOutput
The output could not be written (exit code 4).
Fields
Codec(Error)
The codec rejected the input or output (exit code 5–8, by variant).
Format(String)
An input image format (PNG/PPM) could not be parsed (exit code 9).
RawConfig(String)
Raw-pixel input was misconfigured, e.g. missing dimensions (exit code 8).
Implementations§
Source§impl CliError
impl CliError
Sourcepub fn read_input(label: String, err: &Error) -> Self
pub fn read_input(label: String, err: &Error) -> Self
Build a CliError::ReadInput from a labeled I/O error.
Sourcepub fn write_output(label: String, err: &Error) -> Self
pub fn write_output(label: String, err: &Error) -> Self
Build a CliError::WriteOutput from a labeled I/O error.
Trait Implementations§
Source§impl Error for CliError
impl Error for CliError
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 Freeze for CliError
impl RefUnwindSafe for CliError
impl Send for CliError
impl Sync for CliError
impl Unpin for CliError
impl UnsafeUnpin for CliError
impl UnwindSafe for CliError
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
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> ⓘ
Converts
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> ⓘ
Converts
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