Skip to main content

subspace_core/diagnostics/
runtime.rs

1/// Launch classification captured by the shell, without spawning a process.
2#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3pub enum LaunchKind {
4    Terminal,
5    Desktop,
6    Unknown,
7}
8
9impl LaunchKind {
10    pub(super) fn label(self) -> &'static str {
11        match self {
12            Self::Terminal => "terminal",
13            Self::Desktop => "desktop",
14            Self::Unknown => "unknown",
15        }
16    }
17}
18
19/// Named local runtime fields only. There is deliberately no full PATH field.
20#[derive(Clone)]
21pub struct RuntimeDetails {
22    pub(super) executable: String,
23    pub(super) launch: LaunchKind,
24    pub(super) path_source: String,
25    pub(super) az_path: Option<String>,
26}
27
28impl RuntimeDetails {
29    pub fn new(
30        executable: impl Into<String>,
31        launch: LaunchKind,
32        path_source: impl Into<String>,
33        az_path: Option<String>,
34    ) -> Self {
35        Self {
36            executable: executable.into(),
37            launch,
38            path_source: path_source.into(),
39            az_path,
40        }
41    }
42}