hydra/
process_info.rs

1use serde::Deserialize;
2use serde::Serialize;
3
4use crate::Pid;
5
6/// Debug information for a specific process.
7#[derive(Debug, Serialize, Deserialize)]
8pub struct ProcessInfo {
9    /// The name, if any, that the process was registered under.
10    pub registered_name: Option<String>,
11    /// The number of messages in this processes message queue.
12    pub message_queue_len: usize,
13    /// Whether or not the process is trapping exits.
14    pub trap_exit: bool,
15    /// Collection of linked processes.
16    pub links: Vec<Pid>,
17    /// Collection of processes monitoring this process.
18    pub monitored_by: Vec<Pid>,
19}
20
21impl ProcessInfo {
22    /// Construct a new empty [ProcessInfo].
23    pub const fn new() -> Self {
24        Self {
25            registered_name: None,
26            message_queue_len: 0,
27            trap_exit: false,
28            links: Vec::new(),
29            monitored_by: Vec::new(),
30        }
31    }
32}
33
34impl Default for ProcessInfo {
35    fn default() -> Self {
36        Self::new()
37    }
38}