Struct ExitStatusError
pub struct ExitStatusError(pub(in ::process) ExitStatusError);
Describes the result of a process after it has failed
Produced by the .exit_ok method on ExitStatus.
Examples
# if cfg! // cfg!(unix)
Fields
0: ExitStatusError
Implementations
impl ExitStatusError
fn code(&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) -> 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) -> ExitStatusConverts an
ExitStatusError(back) to anExitStatus.
Trait Implementations
impl Clone for ExitStatusError
fn clone(&self) -> ExitStatusError
impl Copy for ExitStatusError
impl Debug for ExitStatusError
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Display for ExitStatusError
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for ExitStatusError
fn assert_fields_are_eq(&self)
impl Error for ExitStatusError
impl ExitStatusExt for ExitStatusError
fn from_raw(raw: i32) -> Selffn signal(&self) -> Option<i32>fn core_dumped(&self) -> boolfn stopped_signal(&self) -> Option<i32>fn continued(&self) -> boolfn into_raw(self) -> i32
impl PartialEq for ExitStatusError
fn eq(&self, other: &ExitStatusError) -> bool
impl StructuralPartialEq for ExitStatusError
impl TrivialClone for ExitStatusError
Auto Trait Implementations
impl Freeze for ExitStatusError
impl RefUnwindSafe for ExitStatusError
impl Send for ExitStatusError
impl Sync for ExitStatusError
impl Unpin for ExitStatusError
impl UnsafeUnpin for ExitStatusError
impl UnwindSafe for ExitStatusError
Blanket Implementations
impl<T> Any for ExitStatusError
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for ExitStatusError
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for ExitStatusError
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for ExitStatusError
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for ExitStatusError
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Printable for ExitStatusError
where
T: Copy + Debug,
impl<T> SizeHint for ExitStatusError
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for ExitStatusError
impl<T> ToOwned for ExitStatusError
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> ToString for ExitStatusError
where
T: Display + ?Sized,
fn to_string(&self) -> String
impl<T, U> Into<U> for ExitStatusError
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for ExitStatusError
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for ExitStatusError
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>