Enum utf8_command::Error
source · pub enum Error {
Stdout(StdoutError),
Stderr(StderrError),
}
Expand description
An error produced when converting Output
to Utf8Output
, wrapping a FromUtf8Error
.
use std::process::ExitStatus;
use std::process::Output;
use utf8_command::Utf8Output;
use utf8_command::Error;
let invalid = Output {
status: ExitStatus::default(),
stdout: Vec::from(b""),
stderr: Vec::from(b"\xe2\x28\xa1"), // Invalid 3-byte sequence.
};
let result: Result<Utf8Output, Error> = invalid.try_into();
assert_eq!(
result.unwrap_err().to_string(),
"Stderr contained invalid utf-8 sequence of 1 bytes from index 0: \"�(�\""
);
Variants§
Stdout(StdoutError)
The Output
’s stdout field contained invalid UTF-8.
Stderr(StderrError)
The Output
’s stderr field contained invalid UTF-8.
Implementations§
source§impl Error
impl Error
sourcepub fn inner(&self) -> &FromUtf8Error
pub fn inner(&self) -> &FromUtf8Error
Get a reference to the inner FromUtf8Error
.
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)>
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()
source§impl From<Error> for FromUtf8Error
impl From<Error> for FromUtf8Error
source§impl From<StderrError> for Error
impl From<StderrError> for Error
source§fn from(value: StderrError) -> Self
fn from(value: StderrError) -> Self
Converts to this type from the input type.
source§impl From<StdoutError> for Error
impl From<StdoutError> for Error
source§fn from(value: StdoutError) -> Self
fn from(value: StdoutError) -> Self
Converts to this type from the input type.
source§impl PartialEq for Error
impl PartialEq for Error
impl Eq for Error
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe 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