pub trait ProcessManager: Send + Sync {
// Required methods
fn start<'life0, 'async_trait>(
&'life0 self,
command: String,
args: Vec<String>,
working_dir: Option<String>,
) -> Pin<Box<dyn Future<Output = Layer3Result<u32>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn stop<'life0, 'async_trait>(
&'life0 self,
pid: u32,
force: bool,
) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_info<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<Option<ProcessInfo>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_state<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<ProcessState>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn is_alive<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn wait<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<i32>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<ProcessInfo>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list_by_state<'life0, 'async_trait>(
&'life0 self,
state: ProcessState,
) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<ProcessInfo>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn signal<'life0, 'async_trait>(
&'life0 self,
pid: u32,
signal: ProcessSignal,
) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
进程管理器 trait
定义进程管理核心接口。
Required Methods§
Sourcefn start<'life0, 'async_trait>(
&'life0 self,
command: String,
args: Vec<String>,
working_dir: Option<String>,
) -> Pin<Box<dyn Future<Output = Layer3Result<u32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
command: String,
args: Vec<String>,
working_dir: Option<String>,
) -> Pin<Box<dyn Future<Output = Layer3Result<u32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn stop<'life0, 'async_trait>(
&'life0 self,
pid: u32,
force: bool,
) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 self,
pid: u32,
force: bool,
) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn get_info<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<Option<ProcessInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_info<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<Option<ProcessInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
获取进程信息
Sourcefn get_state<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<ProcessState>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_state<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<ProcessState>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
获取进程状态
Sourcefn is_alive<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_alive<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
检查进程是否存活
Sourcefn wait<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<i32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn wait<'life0, 'async_trait>(
&'life0 self,
pid: u32,
) -> Pin<Box<dyn Future<Output = Layer3Result<i32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
等待进程结束
Sourcefn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<ProcessInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<ProcessInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
列出所有管理的进程
Sourcefn list_by_state<'life0, 'async_trait>(
&'life0 self,
state: ProcessState,
) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<ProcessInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_by_state<'life0, 'async_trait>(
&'life0 self,
state: ProcessState,
) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<ProcessInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
列出指定状态的进程
Sourcefn signal<'life0, 'async_trait>(
&'life0 self,
pid: u32,
signal: ProcessSignal,
) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn signal<'life0, 'async_trait>(
&'life0 self,
pid: u32,
signal: ProcessSignal,
) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
发送信号到进程
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".