Document Default for ExitStatus

This lets us put a version on the impl, too.
This commit is contained in:
Ian Jackson 2023-08-07 16:33:04 +01:00
parent c1699a79a6
commit a741a5ad16

View File

@ -1530,10 +1530,19 @@ fn from(file: fs::File) -> Stdio {
// vs `_exit`. Naming of Unix system calls is not standardised across Unices, so terminology is a // vs `_exit`. Naming of Unix system calls is not standardised across Unices, so terminology is a
// matter of convention and tradition. For clarity we usually speak of `exit`, even when we might // matter of convention and tradition. For clarity we usually speak of `exit`, even when we might
// mean an underlying system call such as `_exit`. // mean an underlying system call such as `_exit`.
#[derive(PartialEq, Eq, Clone, Copy, Debug, Default)] #[derive(PartialEq, Eq, Clone, Copy, Debug)]
#[stable(feature = "process", since = "1.0.0")] #[stable(feature = "process", since = "1.0.0")]
pub struct ExitStatus(imp::ExitStatus); pub struct ExitStatus(imp::ExitStatus);
/// The default value is one which indicates successful completion.
#[stable(feature = "process-exitcode-default", since = "CURRENT_RUSTC_VERSION")]
impl Default for ExitStatus {
fn default() -> Self {
// Ideally this would be done by ExitCode::default().into() but that is complicated.
ExitStatus::from_inner(imp::ExitStatus::default())
}
}
/// Allows extension traits within `std`. /// Allows extension traits within `std`.
#[unstable(feature = "sealed", issue = "none")] #[unstable(feature = "sealed", issue = "none")]
impl crate::sealed::Sealed for ExitStatus {} impl crate::sealed::Sealed for ExitStatus {}