pub enum ProcessState {
Running,
Halted(ProcessResult),
}Expand description
Execution state of a process, either running or halted
This type is used to represent the current state of a process. It is similar
to the WaitStatus type defined in the nix crate, but it is simplified to
represent only the states that are relevant to the shell.
This type can represent all possible states of a process, including running,
stopped, exited, and signaled states. When the process is not running, the
state is represented by a ProcessResult.
Variants§
Running
The process is running.
Halted(ProcessResult)
The process has exited, stopped, or been terminated by a signal.
Implementations§
Source§impl ProcessState
impl ProcessState
Sourcepub fn stopped(signal: Number) -> Self
pub fn stopped(signal: Number) -> Self
Creates a new ProcessState instance representing a stopped process.
Sourcepub fn exited<S: Into<ExitStatus>>(exit_status: S) -> Self
pub fn exited<S: Into<ExitStatus>>(exit_status: S) -> Self
Creates a new ProcessState instance representing an exited process.
Sourcepub fn is_stopped(&self) -> bool
pub fn is_stopped(&self) -> bool
Whether the process is stopped
Trait Implementations§
Source§impl Clone for ProcessState
impl Clone for ProcessState
Source§fn clone(&self) -> ProcessState
fn clone(&self) -> ProcessState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProcessState
impl Debug for ProcessState
Source§impl From<ProcessResult> for ProcessState
impl From<ProcessResult> for ProcessState
Source§fn from(result: ProcessResult) -> Self
fn from(result: ProcessResult) -> Self
Source§impl PartialEq for ProcessState
impl PartialEq for ProcessState
Source§impl TryFrom<ProcessState> for ExitStatus
Converts ProcessState to ExitStatus.
impl TryFrom<ProcessState> for ExitStatus
Converts ProcessState to ExitStatus.
For the Running state, the conversion fails with RunningProcess.
Source§type Error = RunningProcess
type Error = RunningProcess
Source§fn try_from(state: ProcessState) -> Result<Self, RunningProcess>
fn try_from(state: ProcessState) -> Result<Self, RunningProcess>
impl Copy for ProcessState
impl Eq for ProcessState
impl StructuralPartialEq for ProcessState
Auto Trait Implementations§
impl Freeze for ProcessState
impl RefUnwindSafe for ProcessState
impl Send for ProcessState
impl Sync for ProcessState
impl Unpin for ProcessState
impl UnwindSafe for ProcessState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more