pub struct ExitCode(pub i32);
Expand description
A special error type that does not print any message when returned from
uumain
. Especially useful for porting utilities to using UResult
.
There are two ways to construct an ExitCode
:
use uucore::error::{ExitCode, UResult};
// Explicit
let res: UResult<()> = Err(ExitCode(1).into());
// Using into on `i32`:
let res: UResult<()> = Err(1.into());
This type is especially useful for a trivial conversion from utils returning i32
to
returning UResult
.
Tuple Fields§
§0: i32
Implementations§
Trait Implementations§
source§impl Error for ExitCode
impl Error for ExitCode
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more