pub struct OpaqueOsExitStatus { /* private fields */ }
Expand description
A platform specific opaque exit status.
An exit status which is not an exit code, e.g. on unix the signal which terminated an process preventing it from exiting with an exit status.
Warning: Besides OpaqueOsExitStatus::target_specific_default()
all other methods only exist on some targets but not all. As such
using them can lead to code which only compiles on some targets.
Implementations§
Source§impl OpaqueOsExitStatus
impl OpaqueOsExitStatus
Sourcepub fn target_specific_default() -> Self
pub fn target_specific_default() -> Self
Creates a instance of this type.
This is meant for allowing non-platform specific tests which handle the case of a non exit code process exit status.
Platform specific tests likely still are needed as what this type means is platform specific.
This will always create the same default value but it’s
a target_specific_value and it’s picked arbitrary so
it’s not really appropriately to implement Default
.
(To make clear why it isn’t consider u32
would default
to 246
or similar arbitrary value.)
Sourcepub fn signal_number(&self) -> i32
pub fn signal_number(&self) -> i32
Return the signal number which did lead to the process termination.
Sourcepub fn from_signal_number(signal: i32) -> Self
pub fn from_signal_number(signal: i32) -> Self
Create a unix OpaqueOsExitStatus
instance based on the signal code
causing the non exit code termination.
Like some other aspects you can define (and test) unrealistic signal numbers. IMHO this is better (more simple, flexible etc.) then to have a result which is potentially target dependent or a implicit target dependent bit masking.
Trait Implementations§
Source§impl Clone for OpaqueOsExitStatus
impl Clone for OpaqueOsExitStatus
Source§fn clone(&self) -> OpaqueOsExitStatus
fn clone(&self) -> OpaqueOsExitStatus
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more