pal::unsupported::process::ExitCode
: use an u8
instead of a bool
This commit is contained in:
parent
b7b9453ea7
commit
dc628c8ecb
@ -255,11 +255,11 @@ pub fn code(self) -> Option<NonZero<i32>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
||||||
pub struct ExitCode(bool);
|
pub struct ExitCode(u8);
|
||||||
|
|
||||||
impl ExitCode {
|
impl ExitCode {
|
||||||
pub const SUCCESS: ExitCode = ExitCode(false);
|
pub const SUCCESS: ExitCode = ExitCode(0);
|
||||||
pub const FAILURE: ExitCode = ExitCode(true);
|
pub const FAILURE: ExitCode = ExitCode(1);
|
||||||
|
|
||||||
pub fn as_i32(&self) -> i32 {
|
pub fn as_i32(&self) -> i32 {
|
||||||
self.0 as i32
|
self.0 as i32
|
||||||
@ -268,10 +268,7 @@ pub fn as_i32(&self) -> i32 {
|
|||||||
|
|
||||||
impl From<u8> for ExitCode {
|
impl From<u8> for ExitCode {
|
||||||
fn from(code: u8) -> Self {
|
fn from(code: u8) -> Self {
|
||||||
match code {
|
Self(code)
|
||||||
0 => Self::SUCCESS,
|
|
||||||
1..=255 => Self::FAILURE,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user