Skip to main content

over_there/core/client/
proc.rs

1use crate::core::reply::{ProcStartedArgs, ProcStatusArgs};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4pub struct RemoteProcStatus {
5    pub id: u32,
6    pub is_alive: bool,
7    pub exit_code: Option<i32>,
8}
9
10impl From<ProcStatusArgs> for RemoteProcStatus {
11    fn from(status: ProcStatusArgs) -> Self {
12        Self {
13            id: status.id,
14            is_alive: status.is_alive,
15            exit_code: status.exit_code,
16        }
17    }
18}
19
20#[derive(Debug, Clone, PartialEq, Eq)]
21pub struct RemoteProc {
22    pub(crate) id: u32,
23}
24
25impl RemoteProc {
26    /// Creates a new remote reference without validating anything about
27    /// the process running or even existing
28    pub fn shallow(id: u32) -> Self {
29        Self { id }
30    }
31
32    pub fn id(&self) -> u32 {
33        self.id
34    }
35}
36
37impl From<ProcStartedArgs> for RemoteProc {
38    fn from(args: ProcStartedArgs) -> Self {
39        Self { id: args.id }
40    }
41}