Struct std::process::ExitCode
pub struct ExitCode(_);
This type represents the status code a process can return to its parent under normal termination.
Numeric values used in this type don’t have portable meanings, and different platforms may mask different amounts of them.
For the platform’s canonical successful and unsuccessful codes, see the SUCCESS
and FAILURE
associated items.
Warning: While various forms of this were discussed in RFC #1937, it was ultimately cut from that RFC, and thus this type is more subject to change even than the usual unstable item churn.
Implementations
impl ExitCode
pub const SUCCESS: ExitCode
The canonical ExitCode for successful termination on this platform.
Note that a ()
-returning main
implicitly results in a successful termination, so there’s no need to return this from main
unless you’re also returning other possible codes.
pub const FAILURE: ExitCode
The canonical ExitCode for unsuccessful termination on this platform.
If you’re only returning this and SUCCESS
from main
, consider instead returning Err(_)
and Ok(())
respectively, which will return the same codes (but will also eprintln!
the error).
Trait Implementations
impl Clone for ExitCode
fn clone(&self) -> ExitCode
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for ExitCode
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Formats the value using the given formatter. Read more
impl Termination for ExitCode
fn report(self) -> i32
Is called to get the representation of the value as status code. This status code is returned to the operating system. Read more
impl Copy for ExitCode
Auto Trait Implementations
impl RefUnwindSafe for ExitCode
impl Send for ExitCode
impl Sync for ExitCode
impl Unpin for ExitCode
impl UnwindSafe for ExitCode
Blanket Implementations
impl<T> From<T> for T
pub fn from(t: T) -> T
Performs the conversion.
pub fn into(self) -> U
Performs the conversion.
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
#41263)recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/process/struct.ExitCode.html