diff options
| author | Aron Parker <hl3mukkel@gmail.com> | 2022-06-09 15:29:58 +0200 |
|---|---|---|
| committer | Aron Parker <hl3mukkel@gmail.com> | 2022-06-09 15:32:01 +0200 |
| commit | 0503bc0149d310cf8d07bbb793687eda5ac2ce72 (patch) | |
| tree | 8f61b73b8124656e7a6d9618e7f5caab01010c5e /library/std/src/os/windows | |
| parent | 6dc598a01b8f7619826b7152be5162e6d37a1754 (diff) | |
| download | rust-0503bc0149d310cf8d07bbb793687eda5ac2ce72.tar.gz rust-0503bc0149d310cf8d07bbb793687eda5ac2ce72.zip | |
Implement ExitCodeExt for Windows
Diffstat (limited to 'library/std/src/os/windows')
| -rw-r--r-- | library/std/src/os/windows/process.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/library/std/src/os/windows/process.rs b/library/std/src/os/windows/process.rs index 1c7e361c2a4..179c6e78807 100644 --- a/library/std/src/os/windows/process.rs +++ b/library/std/src/os/windows/process.rs @@ -194,3 +194,22 @@ impl ChildExt for process::Child { self.handle.main_thread_handle() } } + +/// Windows-specific extensions to [`process::ExitCode`]. +/// +/// This trait is sealed: it cannot be implemented outside the standard library. +/// This is so that future additional methods are not breaking changes. +#[stable(feature = "windows_process_exit_code_from", since = "1.63.0")] +pub trait ExitCodeExt: Sealed { + /// Creates a new `ExitStatus` from the raw underlying `u32` return value of + /// a process. + #[stable(feature = "windows_process_exit_code_from", since = "1.63.0")] + fn from_raw(raw: u32) -> Self; +} + +#[stable(feature = "windows_process_exit_code_from", since = "1.63.0")] +impl ExitCodeExt for process::ExitCode { + fn from_raw(raw: u32) -> Self { + process::ExitCode::from_inner(From::from(raw)) + } +} |
