pub struct ProcessManager { /* private fields */ }Implementations§
Source§impl ProcessManager
impl ProcessManager
pub async fn new() -> Self
Sourcepub async fn start(&self, process: Process) -> Result<ProcessKey>
pub async fn start(&self, process: Process) -> Result<ProcessKey>
Starts a process with the given configuration. implicitly calls
start_process
Sourcepub async fn restart_mode(&self) -> RestartMode
pub async fn restart_mode(&self) -> RestartMode
Returns the current restart mode.
Sourcepub async fn set_restart_mode(&self, restart_mode: RestartMode)
pub async fn set_restart_mode(&self, restart_mode: RestartMode)
Sets the restart mode.
Sourcepub async fn max_restarts(&self) -> usize
pub async fn max_restarts(&self) -> usize
Returns the maximum amount of times a process can be restarted before giving up.
Sourcepub async fn set_max_restarts(&self, max_restarts: usize)
pub async fn set_max_restarts(&self, max_restarts: usize)
Sets the maximum amount of times a process can be restarted before giving up.
Sourcepub fn is_stopped(&self) -> bool
pub fn is_stopped(&self) -> bool
Returns whether the process manager has been stopped or not. If the process manager has been stopped, no new processes can be started.
Sourcepub fn stop(&self)
pub fn stop(&self)
Stops the process manager, halting all processes and preventing new processes from being started.
Sourcepub async fn stop_process(&self, key: ProcessKey) -> Result<()>
pub async fn stop_process(&self, key: ProcessKey) -> Result<()>
Stops a single process.
Sourcepub async fn send_message(
&self,
key: ProcessKey,
message: Cow<'static, [u8]>,
) -> Result<()>
pub async fn send_message( &self, key: ProcessKey, message: Cow<'static, [u8]>, ) -> Result<()>
Send a message to a process over stdin
pub async fn start_process(&self, process: Process) -> Result<ProcessKey>
Sourcepub async fn get_exe_and_pid(
&self,
key: ProcessKey,
) -> Result<(String, Option<u32>)>
pub async fn get_exe_and_pid( &self, key: ProcessKey, ) -> Result<(String, Option<u32>)>
Just gives you the exe, along with the pid, of a managed process
Sourcepub async fn get_pid(&self, key: ProcessKey) -> Result<Option<u32>>
pub async fn get_pid(&self, key: ProcessKey) -> Result<Option<u32>>
Get the pid of a managed process
Sourcepub async fn update_process_args(
&mut self,
key: &ProcessKey,
args: Vec<String>,
) -> Result<()>
pub async fn update_process_args( &mut self, key: &ProcessKey, args: Vec<String>, ) -> Result<()>
update the args of a managed process This will reset previous args if they are not set again changes will be applied after the process restarts
Sourcepub async fn update_process_env(
&mut self,
key: &ProcessKey,
env: impl IntoIterator<Item = (impl ToString, impl ToString)>,
) -> Result<()>
pub async fn update_process_env( &mut self, key: &ProcessKey, env: impl IntoIterator<Item = (impl ToString, impl ToString)>, ) -> Result<()>
update the env of a managed process changes will be applied after the process restarts
pub async fn update_process_fds<F>( &mut self, key: &ProcessKey, f: F, ) -> Result<()>
Sourcepub async fn clear_process_env(&mut self, key: &ProcessKey) -> Result<()>
pub async fn clear_process_env(&mut self, key: &ProcessKey) -> Result<()>
update the env of a managed process changes will be applied after the process restarts
Trait Implementations§
Source§impl Clone for ProcessManager
impl Clone for ProcessManager
Source§fn clone(&self) -> ProcessManager
fn clone(&self) -> ProcessManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more