pal::unsupported::process::ExitCode: use an u8 instead of a bool

This commit is contained in:
Lieselotte 2024-09-19 14:22:50 +02:00
parent b7b9453ea7
commit dc628c8ecb
No known key found for this signature in database
GPG Key ID: 68A9A951C7E1F283

View File

@ -255,11 +255,11 @@ pub fn code(self) -> Option<NonZero<i32>> {
}
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
pub struct ExitCode(bool);
pub struct ExitCode(u8);
impl ExitCode {
pub const SUCCESS: ExitCode = ExitCode(false);
pub const FAILURE: ExitCode = ExitCode(true);
pub const SUCCESS: ExitCode = ExitCode(0);
pub const FAILURE: ExitCode = ExitCode(1);
pub fn as_i32(&self) -> i32 {
self.0 as i32
@ -268,10 +268,7 @@ pub fn as_i32(&self) -> i32 {
impl From<u8> for ExitCode {
fn from(code: u8) -> Self {
match code {
0 => Self::SUCCESS,
1..=255 => Self::FAILURE,
}
Self(code)
}
}