Enum watchexec_events::ProcessEnd

source ·
pub enum ProcessEnd {
    Success,
    ExitError(NonZeroI64),
    ExitSignal(Signal),
    ExitStop(NonZeroI32),
    Exception(NonZeroI32),
    Continued,
}
Expand description

The end status of a process.

This is a sort-of equivalent of the std::process::ExitStatus type which, while constructable, differs on various platforms. The native type is an integer that is interpreted either through convention or via platform-dependent libc or kernel calls; our type is a more structured representation for the purpose of being clearer and transportable.

On Unix, one can tell whether a process dumped core from the exit status; this is not replicated in this structure; if that’s desirable you can obtain it manually via libc::WCOREDUMP and the ExitSignal variant.

On Unix and Windows, the exit status is a 32-bit integer; on Fuchsia it’s a 64-bit integer. For portability, we use i64. On all platforms, the “success” value is zero, so we special-case that as a variant and use NonZeroI* to limit the other values.

Variants§

§

Success

The process ended successfully, with exit status = 0.

§

ExitError(NonZeroI64)

The process exited with a non-zero exit status.

§

ExitSignal(Signal)

The process exited due to a signal.

§

ExitStop(NonZeroI32)

The process was stopped (but not terminated) (libc::WIFSTOPPED).

§

Exception(NonZeroI32)

The process suffered an unhandled exception or warning (typically Windows only).

§

Continued

The process was continued (libc::WIFCONTINUED).

Implementations§

source§

impl ProcessEnd

source

pub fn into_exitstatus(self) -> ExitStatus

Convert a ProcessEnd to an ExitStatus.

This is a testing function only! It will panic if the ProcessEnd is not representable as an ExitStatus on Unix. This is also not guaranteed to be accurate, as the waitpid() status union is platform-specific. Exit codes and signals are implemented, other variants are not.

Trait Implementations§

source§

impl Clone for ProcessEnd

source§

fn clone(&self) -> ProcessEnd

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ProcessEnd

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<ExitStatus> for ProcessEnd

source§

fn from(es: ExitStatus) -> Self

Converts to this type from the input type.
source§

impl PartialEq for ProcessEnd

source§

fn eq(&self, other: &ProcessEnd) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for ProcessEnd

source§

impl Eq for ProcessEnd

source§

impl StructuralPartialEq for ProcessEnd

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.