Struct ExitStatusError
struct ExitStatusError(_)
Describes the result of a process after it has failed
Produced by the .exit_ok method on ExitStatus.
Examples
# if cfg! // cfg!(unix)
Implementations
impl ExitStatusError
fn code(self: &Self) -> Option<i32>Reports the exit code, if applicable, from an
ExitStatusError.In Unix terms the return value is the exit status: the value passed to
exit, if the process finished by callingexit. Note that on Unix the exit status is truncated to 8 bits, and that values that didn't come from a program's call toexitmay be invented by the runtime system (often, for example, 255, 254, 127 or 126).On Unix, this will return
Noneif the process was terminated by a signal. If you want to handle such situations specially, consider using methods fromExitStatusExt.If the process finished by calling
exitwith a nonzero value, this will return that exit status.If the error was something else, it will return
None.If the process exited successfully (ie, by calling
exit(0)), there is noExitStatusError. So the return value fromExitStatusError::code()is always nonzero.Examples
# // #[cfg(unix)]fn code_nonzero(self: &Self) -> Option<NonZero<i32>>Reports the exit code, if applicable, from an
ExitStatusError, as aNonZero.This is exactly like
code(), except that it returns a[NonZero]<[i32]>.Plain
code, returning a plain integer, is provided because it is often more convenient. The returned value fromcode()is indeed also nonzero; usecode_nonzero()when you want a type-level guarantee of nonzeroness.Examples
# if cfg! // cfg!(unix)fn into_status(self: &Self) -> ExitStatusConverts an
ExitStatusError(back) to anExitStatus.
impl Clone for ExitStatusError
fn clone(self: &Self) -> ExitStatusError
impl Copy for ExitStatusError
impl Debug for ExitStatusError
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl Display for ExitStatusError
fn fmt(self: &Self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Eq for ExitStatusError
impl Error for ExitStatusError
impl ExitStatusExt for process::ExitStatusError
fn from_raw(raw: i32) -> Selffn signal(self: &Self) -> Option<i32>fn core_dumped(self: &Self) -> boolfn stopped_signal(self: &Self) -> Option<i32>fn continued(self: &Self) -> boolfn into_raw(self: Self) -> i32
impl Freeze for ExitStatusError
impl PartialEq for ExitStatusError
fn eq(self: &Self, other: &ExitStatusError) -> bool
impl RefUnwindSafe for ExitStatusError
impl Send for ExitStatusError
impl StructuralPartialEq for ExitStatusError
impl Sync for ExitStatusError
impl Unpin for ExitStatusError
impl UnwindSafe for ExitStatusError
impl<T> Any for ExitStatusError
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for ExitStatusError
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for ExitStatusError
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for ExitStatusError
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for ExitStatusError
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for ExitStatusError
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> ToString for ExitStatusError
fn to_string(self: &Self) -> String
impl<T, U> Into for ExitStatusError
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for ExitStatusError
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for ExitStatusError
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>