Code

Enum Code 

Source
#[repr(i32)]
pub enum Code {
Show 29 variants Success = 0, Failure = 1, Unknown = 2, Usage = 64, DataErr = 65, NoInput = 66, NoUser = 67, NoHost = 68, Unavailable = 69, Software = 70, OsErr = 71, OsFile = 72, CantCreat = 73, IoErr = 74, TempFail = 75, Protocol = 76, NoPerm = 77, Config = 78, NotExecutable = 126, NotFound = 127, SIGHUP = 129, SIGINT = 130, SIGKILL = 137, SIGPIPE = 141, SIGALRM = 142, SIGTERM = 143, SIGUSR1 = 138, SIGUSR2 = 140, SIGVTALRM = 154,
}
Expand description

A successful exit is always indicated by a status of 0, or exit::Success. Exit codes greater than zero indicates failure.

Variants§

§

Success = 0

The process exited successfully.

§

Failure = 1

Generic failure.

§

Unknown = 2

Catch-all exit code when the process exits for an unknown reason.

§

Usage = 64

The command was used incorrectly, e.g. with the wrong number of arguments, a bad flag, bad syntax in a parameter, or whatever.

§

DataErr = 65

The input data was incorrect in some way. This should only be used for user’s data and not system files.

§

NoInput = 66

An input file (not a system file) did not exist or was not readable. This could also include erros like “No message” to a mailer (if it cared to catch it).

§

NoUser = 67

The user specified did not exist. This might be used for mail adresses or remote logins.

§

NoHost = 68

The host specified did not exist. This is used in mail addresses or network requests.

§

Unavailable = 69

A service is unavailable. This can occur if a support program or file does not exist. This can also be used as a catch-all message when something you wanted to do doesn’t work, but you don’t know why.

§

Software = 70

An internal software error has been detected. This should be limited to non-operating system related errors if possible.

§

OsErr = 71

An operating system error has been detected. This is intended to be used for such things as “cannot fork”, or “cannot create pipe”. It includes things like getuid(2) returning a user that does not exist in the passwd file.

§

OsFile = 72

Some system file (e.g. /etc/passwd, /var/run/utmp) does not exist, cannot be opened, or has some sort of error (e.g. syntax error).

§

CantCreat = 73

A (user specified) output file cannot be created.

§

IoErr = 74

An error occurred while doing I/O on some file.

§

TempFail = 75

Temporary failure, indicating something that is not really an error. For example that a mailer could not create a connection, and the request should be reattempted later.

§

Protocol = 76

The remote system returned something that was “not possible” during a protocol exchange.

§

NoPerm = 77

You did not have sufficient permission to perform the operation. This is not intended for file system problems, which should use NoInput or CantCreat, but rather for high level permissions.

§

Config = 78

Something was found in an unconfigured or misconfigured state.

§

NotExecutable = 126

Command was found but is not executable by the shell.

§

NotFound = 127

Usually indicates that the command was not found by the shell, or that the command is found but that a library it requires is not found.

§

SIGHUP = 129

The SIGHUP signal is sent to a process when its controlling terminal is closed.

§

SIGINT = 130

The SIGINT signal is sent to a process by its controlling terminal when a user wishes to interrupt the process.

§

SIGKILL = 137

The SIGKILL signal is sent to a process to cause it to terminate immediately. In contrast to SIGTERM and SIGINT, this signal cannot be caught or ignored, and the receiving process cannot perform any clean-up upon receiving this signal.

§

SIGPIPE = 141

The SIGPIPE signal is sent to a process when it attempts to write to a pipe without a process connected to the other end.

§

SIGALRM = 142

The SIGALRM signal is sent to a process when the time limit specified in a call to a preceding alarm setting function (such as setitimer) elapses.

§

SIGTERM = 143

The SIGTERM signal is sent to a process to request its termination. Unlike the SIGKILL signal, it can be caught and interpreted or ignored by the process.

§

SIGUSR1 = 138

The SIGUSR1 signal, like SIGUSR2, is sent to a process to indicate a user-defined condition.

§

SIGUSR2 = 140

The SIGUSR2 signal, like SIGUSR1, is sent to a process to indicate a user-defined condition.

§

SIGVTALRM = 154

The SIGVTALRM signal is sent to a process when the time limit specified for the virtual alarm elapses.

Trait Implementations§

Source§

impl Clone for Code

Source§

fn clone(&self) -> Code

Returns a duplicate 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 Code

Source§

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

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

impl Display for Code

Provides a user-friendly explanation of the exit code.

Source§

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

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

impl From<ErrorKind> for Code

Source§

fn from(kind: ErrorKind) -> Self

Converts to this type from the input type.
Source§

impl From<ExitStatus> for Code

Converts std::process::ExitStatus to an exit code by looking at its ExitStatus::code() value.

On Unix, if the process was terminated by a fatal signal, the corresponding signal exit code is returned. If the passed exit status cannot be determined, exit::Unknown (2) is returned.

Source§

fn from(status: ExitStatus) -> Self

Converts to this type from the input type.
Source§

impl From<Option<i32>> for Code

Source§

fn from(maybe_n: Option<i32>) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Code

Converts an i32 primitive integer to an exit code.

Source§

fn from(n: i32) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Code

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Code

Source§

impl Eq for Code

Source§

impl StructuralPartialEq for Code

Auto Trait Implementations§

§

impl Freeze for Code

§

impl RefUnwindSafe for Code

§

impl Send for Code

§

impl Sync for Code

§

impl Unpin for Code

§

impl UnwindSafe for Code

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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>,

Source§

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.