pub struct ProcessState { /* private fields */ }Expand description
Core structure managing tracked processes.
Implementations§
Source§impl ProcessState
impl ProcessState
Sourcepub fn new<S: AsRef<str>>(namespace: S) -> Result<Self, Box<dyn Error>>
pub fn new<S: AsRef<str>>(namespace: S) -> Result<Self, Box<dyn Error>>
Create a new ProcessState instance with a namespace.
Sourcepub fn add_process(
&mut self,
child: &Child,
label: &str,
command: &str,
) -> Result<(), Box<dyn Error>>
pub fn add_process( &mut self, child: &Child, label: &str, command: &str, ) -> Result<(), Box<dyn Error>>
Add a process to tracking.
Sourcepub fn remove_process(&mut self, pid: u32) -> Result<(), Box<dyn Error>>
pub fn remove_process(&mut self, pid: u32) -> Result<(), Box<dyn Error>>
Remove a process from tracking.
Sourcepub fn update_status(
&mut self,
pid: u32,
status: ProcessStatus,
) -> Result<(), Box<dyn Error>>
pub fn update_status( &mut self, pid: u32, status: ProcessStatus, ) -> Result<(), Box<dyn Error>>
Update a process status manually.
Sourcepub fn refresh(&mut self) -> Result<(), Box<dyn Error>>
pub fn refresh(&mut self) -> Result<(), Box<dyn Error>>
Refresh process statuses.
On Unix, uses kill -0 PID.
On Windows, uses try_wait() if you have a Child handle stored externally.
Sourcepub fn get_running(&self) -> Vec<&ProcessInfo>
pub fn get_running(&self) -> Vec<&ProcessInfo>
Get all running processes.
Sourcepub fn get_all(&self) -> Vec<&ProcessInfo>
pub fn get_all(&self) -> Vec<&ProcessInfo>
Get all tracked processes.
Trait Implementations§
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
Mutably borrows from an owned value. Read more