#[non_exhaustive]pub enum Error {
BrokenPipe(Error),
Io(Error),
}Expand description
Why writing failed.
A closed pipe is its own variant because it is not a failure of the
program. A reader such as head that has read enough closes the stream,
and the caller usually exits quietly. This crate does not choose the exit
code.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
BrokenPipe(Error)
The reader closed the stream before the output was written.
Io(Error)
Any other write or flush failure.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<Error> for Error
impl From<Error> for Error
Source§fn from(error: Error) -> Self
fn from(error: Error) -> Self
Error::Io gives back the error it holds, with its message.
Error::BrokenPipe always converts to an error of
io::ErrorKind::BrokenPipe. When the error it holds already reports
BrokenPipe, as every one From<io::Error> builds does, it gives
that error back, so the OS error code survives. Otherwise it gives a new
BrokenPipe error.
Nothing is boxed, so a caller that returns io::Result keeps a closed
pipe apart without carrying this type’s formatting code.