pub struct WaitStatus {
raw_status: c_int,
}Expand description
子进程的状态编码(对应 waitpid/wait4 返回的 wstatus)。 包含了解析和构造状态值的方法。
Fields§
§raw_status: c_intImplementations§
Source§impl WaitStatus
impl WaitStatus
Sourcepub fn exit_code(ret: u8, sig: u8) -> Self
pub fn exit_code(ret: u8, sig: u8) -> Self
__W_EXITCODE: 构造一个正常退出或因信号终止的状态值。
结构: (Exit Code) << 8 | (Termination Signal)
- ret: 退出码 (0-255)
- sig: 信号编号 (如果为 0 则表示正常退出)
Sourcepub fn stop_code(sig: u8) -> Self
pub fn stop_code(sig: u8) -> Self
__W_STOPCODE: 构造一个子进程被停止的状态值。
结构: (Signal that stopped the child) << 8 | 0x7f
- sig: 导致停止的信号编号
Sourcepub fn continued_code() -> Self
pub fn continued_code() -> Self
构造一个子进程从停止状态恢复继续执行的状态值。
Sourcepub fn termination_signal(&self) -> c_int
pub fn termination_signal(&self) -> c_int
如果 WIFSIGNALED 为真,返回导致子进程终止的信号编号(低 7 位)。
Sourcepub fn exit_status(&self) -> c_int
pub fn exit_status(&self) -> c_int
如果 is_exited() 为真,返回子进程的退出状态码(位于第 8-15 位)。
Sourcepub fn is_signaled(&self) -> bool
pub fn is_signaled(&self) -> bool
检查状态是否表示子进程因未捕获的信号而终止。
Sourcepub fn is_stopped(&self) -> bool
pub fn is_stopped(&self) -> bool
检查状态是否表示子进程被停止信号停止。
Sourcepub fn stop_signal(&self) -> c_int
pub fn stop_signal(&self) -> c_int
如果 is_stopped() 为真,返回导致子进程停止的信号编号。 注意:该宏等价于 __WEXITSTATUS(status),即提取第 8-15 位。
Sourcepub fn is_continued(&self) -> bool
pub fn is_continued(&self) -> bool
检查状态是否表示子进程已从停止状态恢复执行。
Sourcepub fn did_core_dump(&self) -> bool
pub fn did_core_dump(&self) -> bool
检查子进程终止时是否生成了核心转储文件。
Trait Implementations§
Source§impl Clone for WaitStatus
impl Clone for WaitStatus
Source§fn clone(&self) -> WaitStatus
fn clone(&self) -> WaitStatus
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WaitStatus
impl Debug for WaitStatus
Source§impl PartialEq for WaitStatus
impl PartialEq for WaitStatus
impl Copy for WaitStatus
impl Eq for WaitStatus
impl StructuralPartialEq for WaitStatus
Auto Trait Implementations§
impl Freeze for WaitStatus
impl RefUnwindSafe for WaitStatus
impl Send for WaitStatus
impl Sync for WaitStatus
impl Unpin for WaitStatus
impl UnwindSafe for WaitStatus
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.