Sync computers
This commit is contained in:
29
crates/std/src/process.rs
Normal file
29
crates/std/src/process.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
pub struct ExitCode(isize);
|
||||
|
||||
impl ExitCode {
|
||||
pub const SUCCESS: ExitCode = ExitCode(0);
|
||||
|
||||
pub fn to_isize(self) -> isize {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "termination"]
|
||||
pub trait Termination {
|
||||
/// Is called to get the representation of the value as status code.
|
||||
/// This status code is returned to the operating system.
|
||||
fn report(self) -> ExitCode;
|
||||
}
|
||||
|
||||
impl Termination for () {
|
||||
#[inline]
|
||||
fn report(self) -> ExitCode {
|
||||
ExitCode::SUCCESS
|
||||
}
|
||||
}
|
||||
impl Termination for isize {
|
||||
#[inline]
|
||||
fn report(self) -> ExitCode {
|
||||
ExitCode(self)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user